You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Willi Weichselbaumer <we...@ca.ibm.com> on 2007/10/02 03:47:13 UTC
nested schema, xml:base, relative path, absolute path
I am using Xerces 2.6.0
I have not had much luck so far in dealing with embedded schema, unless I
use absolute paths.
If my document contains a
xsi:schemaLocation="http://a internal.xsd"
for validation, internal.xsd is found properly.
If internal.xsd contains:
<xs:import namespace="http://b" schemaLocation="http://server/b.xsd"/>
it finds the schema correctly as well.
Schema b.xsd contains a relative URI to c.xsd:
<xs:import namespace="http://c" schemaLocation="schema/c.xsd"/>
but when it tries to resolve the entity
if (fEntityResolver) {
DOMInputSource* is =
fEntityResolver->resolveEntity(resourceIdentifier->getPublicId(),
resourceIdentifier->getSystemId(),
resourceIdentifier->getBaseURI());
publicID is NULL, systemId is "schema/c.xsd" and baseURI is NULL
If schema c.xsd contains a xml:base attribute
(xml:base="http://server/schema/") the baseURI is not affected (NULL as
well).
Am I missing to set a processing flag?
Do I have to keep track of baseURI information myself?
Do I have to parse the parent schema to extract xml:base information?
Thanks for your help,
Willi
-----------------------------------------------------------------------------------
test.xml (local)
-----------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<a:x
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://a internal.xsd"
xmlns:a="http://a"
xmlns:b="http://b"
xmlns:c="http://c">
<a:a xmlns:a="http://a" xmlns:b="http://b" xmlns:c="http://c">
<a:a_int>1</a:a_int>
<b:b>
<b:b_int>2</b:b_int>
<c:c>
<c:c_int>3</c:c_int>
</c:c>
</b:b>
</a:a>
</a:x>
-----------------------------------------------------------------------------------
internal.xsd (local)
-----------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:a="http://a"
xmlns:b="http://b"
xmlns:c="http://c"
targetNamespace="http://a"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://b" schemaLocation="http://server/b.xsd"/>
<xs:element name="x"/>
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<xs:element name="a_int" type="xs:int"/>
<xs:element ref="b:b"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
-----------------------------------------------------------------------------------
b.xsd (server)
-----------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:b="http://b"
xmlns:c="http://c"
targetNamespace="http://b"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xml:base="http://server/schema/">
<xs:import namespace="http://c" schemaLocation="schema/c.xsd"/>
<xs:element name="b">
<xs:complexType>
<xs:sequence>
<xs:element name="b_int" type="xs:int"/>
<xs:element ref="c:c"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
-----------------------------------------------------------------------------------
c.xsd (server/schema)
-----------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://c" targetNamespace="http://c"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="c">
<xs:complexType>
<xs:sequence>
<xs:element name="c_int" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
--
View this message in context: http://www.nabble.com/nested-schema%2C-xml%3Abase%2C-relative-path%2C-absolute-path-tf4552390.html#a12991373
Sent from the Xerces - C - Users mailing list archive at Nabble.com.