Xsd, attribute in element causes element to not be found during validation

ahiyagaljh

New Member
Im having some problem with an xml file and parsing it using xsd. The problem is that I have an attribute in the hello element. If its removed it works without any probelms. The error happens during parsing using the generade c++ code and the message is:error: no declaration found for element 'hello'And then same errors for all elements and attributes in the xml fileThe document to validate:\[code\]<hello xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="asdf"> <group id="1"> <greeting>Hello label="asdf"</greeting> <name>sun</name> <name>moon</name> <name>world</name> </group></hello>\[/code\]The XML Schema Definition:\[code\]<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:complexType name="group_t"> <xsd:sequence> <xsd:element name="greeting" type="xsd:string"> </xsd:element> <xsd:element name="name" type="xsd:string" maxOccurs="unbounded"> </xsd:element> </xsd:sequence> <xsd:attribute name="id" type="xsd:string" use="required"/></xsd:complexType><xsd:complexType name="hello_t"><xsd:sequence> <xsd:element name="group" type="group_t" maxOccurs="unbounded"> </xsd:element></xsd:sequence><xsd:attribute name="label" type="xsd:string" use="required"/></xsd:complexType><xsd:element name="hello" type="hello_t"></xsd:element></xsd:schema>\[/code\]
 
Back
Top