Title: Message


Hi all;
I am having a small problem and hope you can help.
I am using xerces 2 & jdk1.3 on win2000
I have a w3c schema that allows any attribute on an element.
While parsing an my xml through a validating parser I get the following line for each attribute in that element:
"org.xml.sax.SAXParseException: Attribute "ANY---attr1" must be declared for element type "d"……: (where xyz is the name of the actual attribute in the element).

Not that while validating my xml to my schema using xmlspy - there were no problems.

Did anyone have this problem before?
Any help would be appreciated.

My schema defenition:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="a">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="b">
                                        <xs:complexType>
                                                <xs:sequence>
                                                        <xs:element name="c" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>

                                                </xs:sequence>
                                        </xs:complexType>
                                </xs:element>
                                <xs:element name="d" minOccurs="1" maxOccurs="unbounded">
                                        <xs:complexType>
                                                <xs:simpleContent>
                                                        <xs:extension base="xs:string">
                                                                <xs:anyAttribute/>
                                                        </xs:extension>
                                                </xs:simpleContent>
                                        </xs:complexType>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>

My xml

<?xml version="1.0" encoding="UTF-8"?>
<a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="pathToSchema">
        <b>
                <c>ggg</c>
                <c>ggg</c>
                <c>ggg</c>
        </b>
        <d attr1="ggg" attr2="ggg" attr3="ggg">ggg</d>
        <d attr1="ggg" attr2="ggg" attr3="ggg">ggg</d>
</a>

Reply via email to