Subject: RE: Recursive definition of XML Element
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 11 Oct 2001 11:03:22 +0100
|
There's enough traffic on this list without having questions unrelated to
XSLT.
Mike Kay
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Ma, Yanrui
> Sent: 11 October 2001 00:34
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: 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
|