Hi,
Von: Gloria Yang <gloriayang yang gmail com> Datum: Wed, 20 Jul 2005 11:01:50 +0800 Dear all: I try to validate a SOAP message using libxml2-2.6.20/.libs/lt-testSchemas sample.xsd sample.xml
Since the sample schema and instance were mangle, Gloria resent the documents to me privately; I'll attach those. They include the following corrections: 1. You wrote [1] that you will use the SOAP schema located at "http://www.w3.org/2002/12/soap-envelope/", so I changed the namespace of your SOAP instance from "http://schemas.xmlsoap.org/soap/envelope/" to: <soap:Envelope xmlns:soap="http://www.w3.org/2002/12/soap-envelope" 2. Added schemaLocation to your SOAP-encoding import: <import namespace = "http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/> Without a schemaLocation the processor doesn't know what to fetch. 3. Added an import for the SOAP schema itself: <import namespace = "http://www.w3.org/2002/12/soap-envelope" schemaLocation="http://www.w3.org/2002/12/soap-envelope/"/> 4. Added an import for the XML schema: <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> This was needed for the SOAP schema refers to the "xml:lang" attribute declaration of the XML schema, but uses an import without a schemaLocation: <xs:import namespace="http://www.w3.org/XML/1998/namespace" /> This is clever, but needs additional adjustment on our side: "When no schemaLocation [attribute] is present, the schema author is leaving the identification of that schema to the instance, application or user..." [2]. 5. Added the W3C XML Schema namespace declaration to the instance: xmlns:xsd="http://www.w3.org/2001/XMLSchema" This is needed, because you have the following: <in0 xsi:type="xsd:int"> The value of the xsi:type attribute is defined to be a QName, thus the prefix "xsd" need to be bound to a namespace as well. After this changes, we hit the "@xml:lang" identity-constraint bug described in [3]. But, until the bug is fixed - as a temporary workaround, you could download the SOAP schema, comment out the following: <xs:unique name="xmllang"> <xs:selector xpath="." /> <xs:field xpath="@xml:lang" /> </xs:unique> and import this changed schema instead. Which results in: P:\libxml2-lab\tests\soap>xmllint --noout --schema sample.xsd sample.xml sample.xml validates Hope you are already using catalogs to map the schema location URIs to local files for faster loading. [1] http://mail.gnome.org/archives/xml/2005-July/msg00119.html [2] http://www.w3.org/TR/xmlschema-1/#composition-schemaImport [3] http://mail.gnome.org/archives/xml/2005-July/msg00127.html Cheers, Kasimier
Attachment:
sample.xml
Description: Text Data
Attachment:
sample.xsd
Description: Binary data