Maybe I'm just being stupid, but I think I may be running into a bug (Xerces 2.6.2) regarding redefining a type from a no namespace schema into a namespaced schema.
I get 2 contradictory errors validating an xml file using a schema with this construct: [Error] unittest.xml:2:154: cvc-complex-type.3.2.2: Attribute 'someAttr' is not allowed to appear in element 'test'. [Error] unittest.xml:2:154: cvc-complex-type.4: Attribute 'someAttr' must appear on element 'test'. I'm getting this by running it through dom.Counter or sax.Counter from the xercesSamples.jar (with switches -n -v -s -f). I have a base schema (redefTestBase.xsd) with no namespace like this: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="test" type="testType"/> <xs:complexType name="testType" mixed="false"> <xs:attribute ref="someAttr" use="required"/> </xs:complexType> <xs:simpleType name="someAttrType"> <xs:restriction base="xs:token"/> </xs:simpleType> <xs:attribute name="someAttr" type="someAttrType"/> </xs:schema> then I have second schema (redefTestDerived.xsd) with a namespace that redefines a type from the first schema (which I expect to be coerced into the second schema's namespace) <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="redefTest" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rdt="redefTest" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:redefine schemaLocation="redefTestBase.xsd"> <xs:simpleType name="someAttrType"> <xs:restriction base="rdt:someAttrType"> <xs:enumeration value="SOME VALUE"/> </xs:restriction> </xs:simpleType> </xs:redefine> <xs:element name="unitTest"> <xs:complexType> <xs:sequence> <xs:element ref="rdt:test"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> The unitTest element is just to validate that the element has been coerced. Xerces validates both of these xsds but attempting to validate an xml instance of the second schema fails. <?xml version="1.0" encoding="UTF-8"?> <test xmlns="redefTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="redefTest redefTestDerived.xsd" someAttr="SOME VALUE"/> My impression is something weird may be going on relating to the order in which the parser is applying the coercions and the redefinition. Can someone verify whether this is a bug or if I am missing something? Thanks, Eric -- Eric J. Schwarzenbach Principal Content Architect / Wrycan, Inc. 617.684.0182 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
