[
https://issues.apache.org/jira/browse/XERCESC-1728?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alberto Massari resolved XERCESC-1728.
--------------------------------------
Resolution: Invalid
Xerces implements the xs:import in a strict way, i.e. each namespace must be
imported only from one URL. Your schema don't follow this guideline, as
testelemref1.xsd imports namespace ns2 from testelemref2.xsd, while its root
would be testelemref.xsd.
If you change testelemref.xsd to do
<xs:include schemaLocation="testelemref2.xsd"/>
<xs:import namespace="ns1" schemaLocation="testelemref1.xsd"/>
<xs:element name="elem3">
...
and testelemref1.xsd to do
<xs:import namespace="ns2" schemaLocation="testelemref.xsd"/>
<xs:element name="elem1">
<xs:complexType>
....
Xerces will treat them as valid.
Alberto
> Element defined in the imported schema file can not be correctly referred to
> ----------------------------------------------------------------------------
>
> Key: XERCESC-1728
> URL: https://issues.apache.org/jira/browse/XERCESC-1728
> Project: Xerces-C++
> Issue Type: Bug
> Components: Validating Parser (Schema) (Xerces 1.5 or up only)
> Affects Versions: 2.7.0
> Environment: Windows XP
> Reporter: Bill Yan
>
> There are there schema files in the following:
> testelemref.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="ns2"
> xmlns:nm1="ns1" targetNamespace="ns2" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> <xs:import namespace="ns1" schemaLocation="testelemref1.xsd"/>
> <xs:element name="elem3">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="nm1:elem1"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> testelemref1.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:n0="ns1"
> xmlns:n1="ns2" targetNamespace="ns1" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> <xs:import namespace="ns2" schemaLocation="testelemref2.xsd"/>
> <xs:element name="elem1">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="n0:elem2" minOccurs="0"/>
> <xs:element ref="n1:elem4" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="elem2" type="xs:string"/>
> </xs:schema>
> testelemref2.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="ns2"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> xmlns:nm1="ns2">
> <xs:element name="elem4" type="xs:string"/>
> </xs:schema>
> When I use XercesDOMParser::loadGrammar() to check the validity of
> testelemref.xsd, the following error is reported:
> "Type not found in ns2:elem4 - Line 8, Col 47"
> but when I use XMLSpy to check, it's valid, no error is found.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]