Jump to content
Sign in to follow this  
shulin

any thing wrong with this XSD?

Recommended Posts

<?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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...