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 "Murphy, James" <Ja...@excelergy.com> on 2001/11/27 18:57:48 UTC

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

Yur outa luck.  XercesC implements the W3C May 2001 Schema recommendation as
divined form the namespace.  Microsoft's XML parsers were in use well before
this date and well before XML Schemas were firmed up at all.  That's why
they defined their own schema-like stuff called XDR - XML Data Reduced.
Your instance documents and schema need to be modified because they don't
conform the _real_ (W3C) schema spec.  I hear MSXML 4.0 implements the W3C
recommendation.

Jim



> -----Original Message-----
> From: Neil Sherman [mailto:nsherman@aimltd.co.uk]
> Sent: Tuesday, November 27, 2001 9:37 AM
> To: 'xerces-c-dev@xml.apache.org'
> Subject: 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
> 

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