You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Neil Sherman <ns...@aimltd.co.uk> on 2001/11/27 15:37:08 UTC

Using Xerces to parse an xml document that uses a Schema with Microsoft Namespaces

I am currently working on a project that requires my to be able to parse a 
particular XML document and validate it against a given schema.

I have tried using the saxcount example that comes with the Xerces package 
to validate my XML document against the schema.

i.e.

saxcount -v=always -n -s -f TMT21.xml

Error at file C:\xml parser\xerces-c1_5_2-win32\bin\TMT21.xml, line 2, char 
16
  Message: Unknown element 'TransXChange'

Error at file C:\xml parser\xerces-c1_5_2-win32\bin\TMT21.xml, line 2, char 
16
  Message: Root element different from DOCTYPE

Error at file C:\xml parser\xerces-c1_5_2-win32\bin\TMT21.xml, line 3, char 
212
  Message: Unknown element 'StopPoint'

etc etc.

Investigation has led me to believe that this problem has something to do 
with the fact that the XML Schema my document is using uses the Microsoft 
Namespaces as opposed to the W3c version.  Comparing my schema with the 
schema given as an example there are subtle differences such as the use of 
the required attribute as opposed to the use attribute,

i.e.

Microsoft:  required="no"
W3C:	    use="required"

The schema in the demo file uses the W3c namespaces e.g.

Schema file:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
...

XML file:

<?xml version="1.0" encoding="UTF-8"?>
<personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xsi:noNamespaceSchemaLocation='personal.xsd'>
...

Where as the xml file and schema I wish to use, make use of the Microsoft 
namespaces, e.g.

Schema file:

<?xml version="1.0"?>
<Schema name="document" xmlns="urn:schemas-microsoft-com:xml-data"
        xmlns:dt="urn:schemas-microsoft-com:datatypes">
...

XML file:

<?xml version='1.0'?>
<Document xmlns="x-schema:schema.xml">
...

I would greatly appreciate some advice on this problem, and any pointers to 
helpful information.

Looking forward to your response,

Neil Sherman



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org