Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.1.0
-
None
Description
Found when removing deprecated daf:error() from gif schema, and adding in an initial test.
If you have an element of complex type like:
<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 --> }' /> ...
The fn:error function call won't compile because of its 3 arguments, the third argument which is a "." meaning "this element", errors with
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
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.