shulin Posted October 2, 2007 Share Posted October 2, 2007 <?xml version="1.0" encoding="utf-8"?><xs:schema id="NewSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="elements"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="1000" name="component"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="1000" name="attribute"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="1000" name="name" type="xs:string" /> <xs:element maxOccurs="1000" name="value" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element minOccurs="0" maxOccurs="1000" ref="component" /> <----------HERE </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element></xs:schema>Hi:Could sb help me with the above XSD? I create it using XMLFOX and I keep on getting error msg:Line 18, the "component" element is not declared.But I think I declared it at line 6.Your help is highly appreciated.shu-lin Link to comment Share on other sites More sharing options...
boen_robot Posted October 2, 2007 Share Posted October 2, 2007 Your schema seems to be invalid. I guess in order to refer to an element, that element needs to be declared at the top level.Also, according to XSV, 1000 is usually treated as "unbounded". Here's a slightly changed version of your schema with those changes: <?xml version="1.0" encoding="utf-8"?><xs:schema id="NewSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="elements"> <xs:complexType> <xs:sequence> <xs:element ref="component" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="component"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="attribute"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="name" type="xs:string"/> <xs:element maxOccurs="unbounded" name="value" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element minOccurs="0" maxOccurs="unbounded" ref="component"/> </xs:sequence> </xs:complexType> </xs:element></xs:schema> If you really need the 1000 limitation, feel free to restore it. It should work with it too. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.