Differences between XSD-Validation of Oxygen and Ant

This should cover W3C XML Schema, Relax NG and DTD related problems.
nkutsche
Posts: 3
Joined: Wed Feb 25, 2015 5:10 pm

Differences between XSD-Validation of Oxygen and Ant

Post by nkutsche » Thu Sep 24, 2020 11:17 am

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

tavy
Posts: 234
Joined: Thu Jul 01, 2004 12:29 pm

Re: Differences between XSD-Validation of Oxygen and Ant

Post by tavy » Fri Sep 25, 2020 3:17 pm

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
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply