Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defining a relationship in an XML schema
Message
From
12/12/2007 23:27:57
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
XML
Title:
Defining a relationship in an XML schema
Miscellaneous
Thread ID:
01275410
Message ID:
01275410
Views:
46
Let's say I have a simple schema defining a Person, like so:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="PERSON">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="ID" minOccurs="0"/>
				<xs:element ref="NAME" minOccurs="0"/>
				<xs:element ref="ADDRESS" minOccurs="0"/>
				<xs:element ref="CITY" minOccurs="0"/>
				<xs:element ref="STATE" minOccurs="0"/>
				<xs:element ref="ZIP" minOccurs="0"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="ID" type="xs:integer"/>
	<xs:element name="NAME" type="xs:string"/>
	<xs:element name="ADDRESS" type="xs:string"/>	
	<xs:element name="CITY" type="xs:string"/>
	<xs:element name="STATE" type="xs:string"/>
	<xs:element name="ZIP" type="xs:string"/>
	<xs:element name="PEOPLE">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="PERSON" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
What would I have to do to define a child entity of PERSON, for example, let's say I want to define PURCHASES for the PERSON. There may be many PURCHASES for one PERSON.

My main goal here is to be able to have an XML file that has a one-to-many relationship import into an untyped dataset using DataSet.ReadXML() while preserving the relationship.

Thanks for any help!
Very fitting: http://xkcd.com/386/
Next
Reply
Map
View

Click here to load this message in the networking platform