[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Recursive definition of XML Element

Subject: Recursive definition of XML Element
From: "Ma, Yanrui" <YMa@xxxxxxxxxxx>
Date: Wed, 10 Oct 2001 19:33:58 -0400
recursive xml elements
Is recursive definition of XML elements allowed? I have a need for a
recursive xml element like this:

	<Node process="T">
		<Node process="S">
			<Node process="C1">
				<Node process="C2">
					<Node process="P1"/>
					<Node process="P2"/>
					<Node process="P3"/>
				</Node>
				<Node process="C3">
					<Node process="P4"/>
					<Node process="P5"/>
					<Node process="P6"/>
				</Node>
			</Node>
		</Node>
		<Node process="Y1"/>
	</Node>

My corresponding schema file (.xsd) is like:

	<xs:complexType name="NodeType">
		<xs:sequence minOccurs="0" maxOccurs="unbounded">
			<xs:choice>
				<xs:element name="Node" type="NodeType"/>
				<xs:element name="NodeRef">
					<xs:complexType>
						<xs:attribute name="name"
type="xs:string" use="optional"/>
						<xs:attribute name="node"
type="xs:string" use="required"/>
					</xs:complexType>
				</xs:element>
				<xs:element name="Cluster">
					<xs:complexType>
						<xs:sequence
maxOccurs="unbounded">
							<xs:element
name="Node" type="NodeType"/>
						</xs:sequence>
						<xs:attribute name="name"
type="xs:string" use="required"/>
					</xs:complexType>
				</xs:element>
			</xs:choice>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string"/>
		<xs:attribute name="process" type="xs:string"/>
	</xs:complexType>

The xml file itself can be parsed, but when parsed together with xsd
validation(using xerces/xalan), the following error happens:
"The attribute 'process' is already used in element 'Node'."

Any idea? Is the above XML valid, or is this a bug/defect of Apache parser?
If the XML is invalid, could you suggest an alternative?

Thanks,

Yanrui

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.