Hi Xerces, I have a problem.
The following schema (work.xsd) "works": --------- <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ln="http://foo" targetNamespace="http://foo"> <xs:element name="foo"> <xs:complexType> <xs:sequence> <xs:element name="bar" form="qualified" type="ln:barType"> </xs:element> <xs:element name="bar" form="qualified" type="ln:barType"> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="barType"/> </xs:schema> --------- Running "DOMPrint -n -s test-work.xml" with the following file (test-work.xml) produces good output. --------- <?xml version="1.0" encoding="UTF-8"?> <foo xmlns="http://foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://foo work.xsd" > <bar/> <bar/> </foo> --------- But the following schema (dont-work.xsd) does not "work". --------- <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ln="http://foo" targetNamespace="http://foo"> <xs:element name="foo"> <xs:complexType> <xs:sequence> <xs:element name="bar" form="qualified"> <xs:complexType /> </xs:element> <xs:element name="bar" form="qualified"> <xs:complexType /> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="barType"/> </xs:schema> --------- With the following file (test-dont-work.xml) it fails with the error: Error at file "[...]/dont-work.xsd", line 12, column 47 Message: element 'bar' declared more than once in the same scope --------- <?xml version="1.0" encoding="UTF-8"?> <foo xmlns="http://foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://foo dont-work.xsd" > <bar/> <bar/> </foo> --------- On the other hand, the xmllint program from libxml is happy with both. The only difference between the two schemas is that the first one refers to a global empty complexType while the second schema embeds the complexType. Sorry for the vocabulary, this is all new to me. So what do I do wrong? Is xerces (3.1.1) correct here? (please, tell me it's a bug, my schemas are complex and I can't extract the complexType as I did for this tiny test case! I also need to put several elements the one after the other, in my real case attributes differ and many other little tiny details, I can't use minOccurs...). Regards, Cédric.
