DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27055>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27055 DOM level 3 : Cannot import 2 XSD within the same namespace Summary: DOM level 3 : Cannot import 2 XSD within the same namespace Product: Xerces2-J Version: 2.6.1 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: Other AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] In a XSD schema such as: <xs:schema targetNamespace="ABC" xmlns:abc="ABC" xmlns:b="B" xmlns:c="B" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="B" schemaLocation="B.xsd"/> <xs:import namespace="B" schemaLocation="C.xsd"/> <xs:element name="A"> <xs:complexType> <xs:sequence> <xs:element name="B" type="b:BType"/> <xs:element name="C" type="c:CType"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> The second <import/> is ignored, along side the declaration for CType Using the following code: String strXml = "<A xmlns='ABC'><B>b</B><C>c</C></A>"); javax.xml.parsers.DocumentBuilderFactory dbf= javax.xml.parsers.DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setAttribute("http://xml.org/sax/features/validation",Boolean.FALSE); dbf.setAttribute("http://apache.org/xml/features/nonvalidating/load-external- dtd", Boolean.FALSE); javax.xml.parsers.DocumentBuilder parser = dbf.newDocumentBuilder(); // Load XML without validating it Document dom = parser.parse(new org.xml.sax.InputSource(new java.io.StringReader (strXml))); // Now validate against arbitrary schema org.w3c.dom.DOMConfiguration config = Document.getDomConfig(); config.setParameter("error-handler", myErrorHandler); config.setParameter("validate", Boolean.TRUE); config.setParameter("schema-type", "http://www.w3.org/2001/XMLSchema"); config.setParameter("schema-location", "ABC A.xsd"); Document.normalizeDocument(); I get the following parsing error: error at (9, 46)! src-resolve: Cannot resolve the name 'c:CType' to a(n) 'type definition' component. ====================================== For completeness: B.XSD <xs:schema targetNamespace="B" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:simpleType name="BType"> <xs:restriction base="xs:string"> <xs:pattern value="[bB]*"/> </xs:restriction> </xs:simpleType> </xs:schema> C.XSD <xs:schema targetNamespace="B" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:simpleType name="CType"> <xs:restriction base="xs:string"> <xs:pattern value="[cC]*"/> </xs:restriction> </xs:simpleType> </xs:schema> ======================================== Also, everything works perfectly when importing elements from different namespaces: A.XSD <xs:schema targetNamespace="ABC" xmlns:abc="ABC" xmlns:b="B" xmlns:c="C" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="B" schemaLocation="B.xsd"/> <xs:import namespace="B" schemaLocation="C.xsd"/> [... as before] C.XSD <xs:schema targetNamespace="C" [... as before] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
