EJ Ciramella wrote:
I'm having a bit of trouble validating a very simple xml file (for
testing purposes).
Can anyone shed some light on this for me please? Here is my build script: <target name="build">
  <xmlvalidate failonerror="true" lenient="false" warn="true"
file="test.xml" classname="org.apache.xerces.parsers.SAXParser"> <attribute name="http://xml.org/sax/features/validation";
                 value="true"/>
      <attribute name="http://apache.org/xml/features/validation/schema";
                 value="true"/>
  </xmlvalidate>
  <xslt basedir="." includes="test.xml" destdir="." extension=".html"
style="test.xsl"/>
</target>
Here is my xml file: <?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<tester xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="file://e:/work/docs/engineering/builds/te
st.xsd">
    <test>Hello world</test>
</tester>
Here is my xsd file: <?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
   <xs:element name="tester">
       <xs:complexType>
           <xs:sequence>
               <xs:element name="test" type="xs:string"/>
           </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
No matter what I do, I wind up with the following error:

1. Ant1.7's <schemavalidate> adds schema awareness to xmlvalidate. use it if you can -the beta is out now

cvc-elt.1: Cannot find the declaration of element 'tester'.

Its a xerces error, probably that it hasnt picked up the no-namespace schema location.

If you can't upgrade to ant1.7 and its new task, copy it and set the no namespace location based on the relevant xerces property:

http://xerces.apache.org/xerces-j/properties.html




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to