This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Recursive definition of XML Element


There's enough traffic on this list without having questions unrelated to
XSLT.

Mike Kay

> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Ma, Yanrui
> Sent: 11 October 2001 00:34
> To: 'xsl-list@lists.mulberrytech.com'
> Subject: [xsl] Recursive definition of XML Element
>
>
> 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
>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]