- From: Lin, QingFeng (William) <QingFeng_Lin@jdedwards.com>
- Date: Mon, 23 Oct 2000 09:50:17 -0600
- To: "'xml-uri@w3.org'" <xml-uri@w3.org>, "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
- Cc: "Kashanian, Kamran" <Kamran_Kashanian@jdedwards.com>
Hi:
Does anybody know how to write a schema for an XML document with
multiple namespace?
For example.
File:test.xml
<?xml version="1.0" ?>
<test xmlns="http://test"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:schemaLocation="http://test test.xsd">
<ns1:a xmlns:ns1="http://test/ns1">this is a</ns1:a>
<ns2:b xmlns:ns2="http://test/ns2">this is b</ns2:b>
</test>
One way I have tried is as following:
file:test.xsd
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/1999/XMLSchema"
targetNamespace="http://test" xmlns:ns0="http://test"
xmlns:ns2="http://test/ns2" xmlns:ns1="http://test/ns1">
<element name="test" type="ns0:testType"/>
<import namespace="http://test/ns1" schemaLocation="a.xsd"/>
<import namespace="http://test/ns2" schemaLocation="b.xsd"/>
<complexType name="testType" content="elementOnly">
<element name="a" ref="ns1:aType"/>
<element name="b" ref="ns2:bType"/>
</complexType>
</schema>
file:a.xsd
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2000/XMLSchema"
targetNamespace="http://test/ns1">
<SimpleType name="aType" base="string" derivedBy="list"/>
</schema>
file:b.xsd
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2000/XMLSchema"
targetNamespace="http://test/ns2">
<SimpleType name="bType" base="string" derivedBy="list"/>
</schema>
But Apache XML Parser can't validate XML document with this schema.
Any knows what will be right schema for test.xml?
Thanks
William Lin
OneWorld Tools Software Analyst/Programmer
J.D. Edwards World Source Company
(303)334-8930
qingfeng_lin@JDEdwards.com
Agile, collaborative solutions for the Internet economy
Received on Monday, 23 October 2000 11:51:18 UTC