You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Steve Lawrence (Jira)" <ji...@apache.org> on 2023/03/01 13:11:00 UTC

[jira] [Commented] (DAFFODIL-2800) appinfo annotations with distinct source are being misinterpreted as DFDL annotations.

    [ https://issues.apache.org/jira/browse/DAFFODIL-2800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17695065#comment-17695065 ] 

Steve Lawrence commented on DAFFODIL-2800:
------------------------------------------

I think your observation about the xsat element not having a prefix is spot on.

In the first example, if I add {{xmlns="foo"}} to the xsat element, it works as expected.

I'm also guessing that in your second example you have defined the no-prefix namespace to be the XSD namespace (i.e. xmlns="http://www.w3.org/2001/XMLSchema"). So in that example, your xsat2 element is actually in the XSD namespace.

So seems like it has something to do with no-namespace.

I can't explain why the zip TDML isn't erroring. Maybe validation of the DFDL schemas is disabled or broken when from the TDML runner? 


Looking at the XSD for DFDL, we enable lax validation for elements not in the DFDL namespace using this:

{code:xml}
    <xsd:any namespace="##other" processContents="lax" />
{code}

I wonder if ##other does not mach no-namespace? If I change that line to {{namespace="##local"}} it works. But then it fails when xsat does have a namespace.

So If I change that line to something like this it works:

{code:xml}
  <xsd:choice>
      <xsd:any namespace="##other" processContents="lax" />
      <xsd:any namespace="##local" processContents="lax" />
  </xsd:choice>
{code}

Does that seem reasonable? I can open a PR with some tests if so, this seems pretty important to fix.

Note that we do have a temporary workaround, which is to when using non-DFDL annotations, just make sure they have a namespace.

> appinfo annotations with distinct source are being misinterpreted as DFDL annotations.
> --------------------------------------------------------------------------------------
>
>                 Key: DAFFODIL-2800
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2800
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Front End
>    Affects Versions: 3.4.0
>            Reporter: Mike Beckerle
>            Priority: Major
>
> This bug prevents use of annotations other than DFDL annotations in schemas. 
> This makes it impossible for me to use my XSAT2 schema scanner to check for problems in DFDL schemas because the special annotations XSAT2 supports are not being ignored by Daffodil. 
> I have this type which carries a special annotation that is NOT a DFDL annotation:
> ```xml
> <xs:simpleType name="tHexBinary" dfdl:lengthKind="explicit">
>   <xs:restriction base="xs:hexBinary">
>     <xs:annotation>
>       <xs:appinfo source="urn:com.owlcyberdefense.xsat2">
>         <xsat2>
>           <nonRemediation>
>             This type is used only by DFI 9100 and DFI 4242 which are
>             defined to be opaque fixed length byte strings by the VMF specification.
>           </nonRemediation>
>         </xsat2>
>       </xs:appinfo>
>     </xs:annotation>
>   </xs:restriction>
> </xs:simpleType>
> ```
> The source attribute indicates this is about something that is NOT DFDL. 
>  
> Note that the xsat2 and nonRemediation attributes do NOT carry a namespace prefix. That may or may not be important. 
>  
> I get compilation errors like:
> ```
> [error] Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException; lineNumber: 56; columnNumber: 24; cvc-complex-type.2.4.a: Invalid content was found starting with element 'xsat2'. One of '\{"http://www.ogf.org/dfdl/dfdl-1.0/":assert, "http://www.ogf.org/dfdl/dfdl-1.0/":choice, "http://www.ogf.org/dfdl/dfdl-1.0/":defineEscapeScheme, "http://www.ogf.org/dfdl/dfdl-1.0/":defineFormat, "http://www.ogf.org/dfdl/dfdl-1.0/":defineVariable, "http://www.ogf.org/dfdl/dfdl-1.0/":discriminator, "http://www.ogf.org/dfdl/dfdl-1.0/":element, "http://www.ogf.org/dfdl/dfdl-1.0/":enumeration, "http://www.ogf.org/dfdl/dfdl-1.0/":format, "http://www.ogf.org/dfdl/dfdl-1.0/":group, "http://www.ogf.org/dfdl/dfdl-1.0/":newVariableInstance, "http://www.ogf.org/dfdl/dfdl-1.0/":sequence, "http://www.ogf.org/dfdl/dfdl-1.0/":setVariable, "http://www.ogf.org/dfdl/dfdl-1.0/":simpleType, WC[##other:"http://www.ogf.org/dfdl/dfdl-1.0/"]}' is expected.
> ```
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)