Michael Beckerle created DAFFODIL-1905:
------------------------------------------

             Summary: fn:error all args assumed to be string, but 3rd arg isn't 
supposed to have to be a string.
                 Key: DAFFODIL-1905
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1905
             Project: Daffodil
          Issue Type: Bug
          Components: Middle "End"
    Affects Versions: 2.1.0
            Reporter: Michael Beckerle
             Fix For: 2.2.0


Found when removing deprecated daf:error() from gif schema, and adding in an 
initial test.

If you have an element of complex type like:
{code}
<xs:element name="Header">
                <xs:complexType>
                        <xs:sequence>
                                <xs:sequence 
dfdl:hiddenGroupRef="hidden_GIF_Signature_Group" />
                                <xs:element name='Signature' type='xs:string' 
dfdl:inputValueCalc='{
                                        if (xs:string(../Hidden_Signature) eq 
"474946") then "GIF"    
                                        else fn:error("gif", "fn:error 
called.",  .) <!-- LOOK HERE -->
                                        }' />
     ...
{code}
The fn:error function call won't compile because of its 3 arguments, the third 
argument which is a "." meaning "this element", errors with 
{code}
Caused by: Schema Definition Error: The type Complex cannot be converted to 
String.
Schema context: element reference {}Global_Color_Table Location line 50 column 
18 in 
file:/home/mbeckerle-unencrypted/DFDLSchemas/gif/bin/com/mitre/gif/xsd/gif.dfdl.xsd

{code}
The daffodil implementation of fn:error says all 3 arguments are type String. 
This third argument is type Any. It's documented to be "the object causing the 
error" in XPath. 

A fix will loosen this restriction, allowing that 3rd argument to be anything. 
Of course it then has to accept and do something with anything there. 

In particular, if  a complex type element is passed there, it has to do 
something meaningful.




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to