W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2003

error populating DB due to the schema (VS.NET)

From: <fe.sola@infomed.sld.cu>
Date: Wed, 24 Sep 2003 12:29:38 -0400
Message-ID: <1064420978.3f71c672445d8@webmail.sld.cu>
To: xmlschema-dev@w3.org

Hello all:
This is slightly OT cause it has to do with .NET datasets. 
I have an xsd file that describes my database structure and I generated a dataset from 
it. I have several xml files with data I should insert into the database, these files 
are validated okay against the schema and I populate my dataset succesfully with the xml 
data. 
The problem is I'm getting errors when I try to insert each table's data from the 
dataset into the database, when I have a Parent-Child relation, I try to start inserting 
the Parent table data first but the dataset is taking several relations in the oposite 
way (when created), ie, ThesisLanguage table is a parent of Thesis table (One thesis is 
published in one language, so Thesis table has a foreing key ThesisLanguageId), one to 
one relation, but instead the dataset shows that relation inverted, Thesis is the parent 
of ThesisLanguage, so in the ThesisLanguage table of the dataset appears a ThesisId as a 
foreign key. I get an error trying to insert this data into the database because there's 
no field named ThesisId in the ThesisLanguage table of my database.

How could I change the schema to avoid this?
Thanks for taking a look at this, 
Lizet

The schema structure is this one (sorry for this long post):


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" 
attributeFormDefault="unqualified">
	<xs:element name="Thesis">
		<xs:annotation>
			<xs:documentation>thesis data</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="thesisNumber" type="xs:string"/>
				<xs:element name="ipc" type="xs:string"/>
				<xs:element name="pct" type="xs:string"/>
				<xs:element name="applicationNumber" type="xs:string"/>
				<xs:element name="dateFilled" type="xs:string"/>
				<xs:element name="dateDefended" type="xs:string"/>
				<xs:element name="title" type="xs:string"/>
				<xs:element name="abstract" type="xs:string"/>
				<xs:element name="description" type="xs:string"/>
				<xs:element name="country" type="xs:string"/>
				<xs:element name="alternateContentStorage" 
type="xs:base64Binary" minOccurs="0"/>
				<xs:element name="contentType" minOccurs="0" 
maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element 
name="documentFormat" type="xs:string"/>
							<xs:element name="indexable" 
type="xs:boolean"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="thesisLanguage">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="languageName" 
type="xs:string"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="otherReferences" minOccurs="0" 
maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="description" 
type="xs:string"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="claims" minOccurs="0" 
maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="claim" 
type="xs:string"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="image" minOccurs="0" 
maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="description" 
type="xs:string"/>
							<xs:element name="format" 
type="xs:string"/>
							<xs:element name="imageStorage" 
type="xs:base64Binary"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="thesisReferencesthesis" minOccurs="0" 
maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element 
ref="thesisReferences"/>
							<xs:element name="description" 
type="xs:string"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="thesisApplicants" minOccurs="0" 
maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element ref="identityInfo"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="thesisAuthors" minOccurs="0" 
maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element ref="identityInfo"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="thesisOwners" minOccurs="0" 
maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element ref="identityInfo"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="identityInfo">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="firstName">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="50"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="lastName" minOccurs="0">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="50"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="address" minOccurs="0">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="100"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="city" minOccurs="0">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="50"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="state" minOccurs="0">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="50"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="pobox" minOccurs="0">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="10"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="zip" minOccurs="0">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="10"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="country" minOccurs="0">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="100"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="thesisReferences">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="thesisNumber" type="xs:string"/>
				<xs:element name="applicationNumber" type="xs:string"/>
				<xs:element name="dateDefended" type="xs:dateTime"/>
				<xs:element name="referenceCited" type="xs:string"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>


-------------------------------------------------
Este mensaje fue enviado usando el servicio de correo en web de Infomed
http://webmail.sld.cu
Received on Wednesday, 24 September 2003 12:39:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:39 GMT