Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-1905

fn:error all args assumed to be string, but 3rd arg isn't supposed to have to be a string.

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.1.0
    • None
    • Middle "End"

    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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            mbeckerle Mike Beckerle

            Dates

              Created:
              Updated:

              Slack

                Issue deployment