jo******@gmail.com wrote:
If you could help me out with more more thing that would be great, you
have been very helpful.
Again trying to build a schema based on the following XML. I
understand how to describe the 'one' element I dont understand how to
describe the soap message within the schema.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<one xsi:type="xsd:string>test</one>
</soapenv:Body>
</soapenv:Envelope>
You need to have two schemas then as one schema can only describe the
elements in one particular target namespace while your XML instance
above has elements in the namespace
http://schemas.xmlsoap.org/soap/envelope/ and in no namespace.
So a possible solution is
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"
version="1.0">
<xs:import schemaLocation="test2005060902Xsd.xml" />
<xs:element name="Envelope">
<xs:complexType>
<xs:sequence>
<xs:element name="Body">
<xs:complexType>
<xs:sequence>
<xs:element ref="one" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
where the imported schema test2005060902Xsd.xml is
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0">
<xs:element name="one" type="xs:string" />
</xs:schema>
and the instance is
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
test2005060901XSd.xml">
<soapenv:Body>
<one xsi:type="xsd:string">test</one>
</soapenv:Body>
</soapenv:Envelope>
--
Martin Honnen
http://JavaScript.FAQTs.com/