Hi Simon,

At 06:59 PM 1/9/2006 +0100, Simon wrote:

Hi Alberto,

I have again a question to Xerces-C. I have the following XSD file:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";><xs:element name="shiporder">
<xs:complexType>
 <xs:sequence>
  <xs:element name="orderperson" type="xs:string"/>
  <xs:element name="shipto">
   <xs:complexType>
    <xs:sequence>
     <xs:element name="name" type="xs:string"/>
     <xs:element name="address" type="xs:string"/>
     <xs:element name="city" type="xs:string"/>
     <xs:element name="country" type="xs:string"/>
    </xs:sequence>
   </xs:complexType>
  </xs:element>
  <xs:element name="item" maxOccurs="unbounded">
   <xs:complexType>
    <xs:sequence>
     <xs:element name="title" type="xs:string"/>
     <xs:element name="note" type="xs:string" minOccurs="0"/>
     <xs:element name="quantity" type="xs:positiveInteger"/>
     <xs:element name="price" type="xs:decimal"/>
    </xs:sequence>
   </xs:complexType>
  </xs:element>
 </xs:sequence>
 <xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element></xs:schema>

and the following XML file:

<?xml version="1.0" encoding="ISO-8859-1"?><shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
 <name>Ola Nordmann</name>
 <address>Langgt 23</address>
 <city>4000 Stavanger</city>
 <country>Norway</country>
</shipto>
<item>
 <title>Empire Burlesque</title>
 <note>Special Edition</note>
 <quantity>1</quantity>
 <price>10.90</price>
</item>
<item>
 <title>Hide your heart</title>
 <quantity>1</quantity>
 <price>9.90</price>
</item>
</shiporder>

I want to validate the XML file with respect to the XSD file. When I use the following online-validator:

http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx

the validation results fine. But when I launch DOMCount -v=always with the XML file as parameter I get a lot of errors like the following:

Error at file D:\Masterarbeit Simon Perathoner\Materialsammlung\XML_docs/shiporder.xml, line 1, char 54
 Message: Unknown element 'shiporder'

Can you tell me what is going wrong? What do I have to change in the input files to get a positive validation output with Xerces-C?

In order to perform schema validation you must turn on both namespace processing and schema validation; the correct command line is

  DOMCount -n -s -v=always shiporder.xml


Thank you very much for your help!!!

Simon

PS: Sorry for bothering you again directly, but the messages which I send to [email protected] are not posted in the user mail archive of Xerces-C... While your answers are visible in the archive, the questions I have sent are not. Do I have to register somewhere? I haven't found any registration page for the mailing list...

In order to subscribe to the mailing list, send an empty message to [EMAIL PROTECTED]

Alberto

Reply via email to