Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Defining a relationship in an XML schema
Message
De
13/12/2007 08:26:01
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
13/12/2007 04:20:02
Information générale
Forum:
ASP.NET
Catégorie:
XML
Divers
Thread ID:
01275410
Message ID:
01275439
Vues:
6
>Hi,
>>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.
>
>Basically:
>Design a PURCHASE element using the same pattern as for the PERSON element above then include it in the PERSON element in the same way that the PERSON element is contained in the PEOPLE element...
>
>BTW the PERSON element looks a bit odd. All the child elements have a 'MinOccurs=0' implying that a completely empty PERSON element is acceptable.

It was just an example and I didn't even think about it when I was copying and pasting.

>>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.
>
>Why not do this the easy way : build a Dataset and create the schema from that?

I couldn't do this before because I was reading the XML into a cursor in VFP and was having problems with making VFP recognize the .NET schema. I tried to do a more generic schema.

Now that I am using strictly .NET, I am going to try this. Thanks for the idea.

>Best,
>Viv
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform