Substitution Group [message #597969] |
Tue, 18 April 2006 11:21 |
tatini venkate Messages: 19 Registered: July 2009 |
Junior Member |
|
|
Hi
I have a schema file which has 'persons' as root element.
'persons' has 'person' as child element which has 'Name' as child element.
I declared another element called 'FirstName' which can be substituted to
element 'Name'
Now I need to identify what are all the elements can be substuted in place
of element 'Name'.
In the above example I can use 'FirstName' instede of 'Name' in my XML doc.
Is there any way to get substitution list from XSD parser ?.
Here I am attaching sample schema and XML docs.
Thanks
Param
Family.xsd
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.gxs.com" targetNamespace="http://www.gxs.com"
elementFormDefault="qualified">
<xs:element name="person" >
<xs:complexType>
<xs:sequence>
<xs:element ref="Name"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="persons">
<xs:complexType>
<xs:sequence>
<xs:element ref="person" maxOccurs="40" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Name" type="xs:string"/>
<xs:element name="FirstName" type="xs:string" SubstitutionGroup="Name"/>
</xs:schema>
Family.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2005 rel. 3 U
(http://www.altova.com)-->
<persons xmlns="http://www.gxs.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.gxs.com
family.xsd">
<person>
<Name>Name</Name>
</person>
<person>
<FirstName>FirstName</FirstName>
</person>
</persons>
|
|
|
Powered by
FUDForum. Page generated in 0.03405 seconds