Page 1 of 1

Differences between XSD-Validation of Oxygen and Ant

Posted: Thu Sep 24, 2020 11:17 am
by nkutsche
Hi,

I wrote an XSD schema for a customer who wants to validate his XML documents against it in Oxygen as well as in an Ant pipeline.

This works fine in the past, but now I have the issue that the customer uses sometimes inline Entity declarations in his documents like this:

Code: Select all

<!DOCTYPE root [<!ENTITY foo "bar">]>
<root>
    <child>&foo;</child>
</root>
In Oxygen the validation still works, but the Ant pipline fails with:

Element type "root" must be declared.
Element type "child" must be declared

My challenge is now to configure the Xerces call in Ant so that it does not try to validate against the "inline DTD".

My current Ant call looks like this:

Code: Select all

<project basedir="." name="schema-validation-test" default="test">
  <target name="test">
      <schemavalidate failonerror="true" file="src.xml" nonamespacefile="schema.xsd">
          
      </schemavalidate>
  </target>
</project>
As this is more an Xerces issue, I have already asked a regarding question on stackoverflow (https://stackoverflow.com/questions/639 ... is-present), where you can also find the details about my issue. Unfortunately, I didn't get any feedback yet. :cry:

But I assume that Oxygen also calls the Xerces internally, so maybe one of the developer can leak, how you call it to avoid these unwanted messages. :wink:

Thanks for your help!

Best Regards,
Nico

Re: Differences between XSD-Validation of Oxygen and Ant

Posted: Fri Sep 25, 2020 3:17 pm
by tavy
Hello Nico,

I think you need to set the "schemaLanguage" property. Something like this:

Code: Select all

<project basedir="." name="schema-validation-test" default="test">
    <target name="test">
        <schemavalidate file="src.xml" noNamespaceFile="schema.xsd" failonerror="true">
            <property name="http://java.sun.com/xml/jaxp/properties/schemaLanguage" value="http://www.w3.org/2001/XMLSchema"/>
        </schemavalidate>
    </target>
</project>
Best Regards,
Octavian