Loading relational data using Bulkupload XSD and XML -
01-07-2004
, 12:34 PM
Hi all,
I am using SQLXML3.0 bulkupload to upload my data from a
XML file. I created a XML schema for the data file. when
I just used one table it worked fine. As soon as I started
adding the next level tables I got
" Start position is before the beggining or past the end
of row set"
later I tried created the whole schema and it validated
againt the database (giving errors and fixing them) then I
got " Error opening the data file " error.
I am trying to validate the schema with data file using
XMLSPY. I am getting weird errors which I can't fix.
Errors from XMLSPY:
mandatory element ' lOriginalBookletCount' expected in
place of 'lOriginalBookletCount'
after I added the minOccures to each integer element the
error is changed to School element, which is a child
table.
Once I add the minOccures to school , I get " Unexpected
child element lOriginalBookletCount' "
Any help is appreciated. Here is my part of the XML data
and Schema files. Thanks
Sandhya
Schema:
-------
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 3 U
(http://www.xmlspy.com) by sandhya (DRC) -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship
name="batchschool" parent="batch" parent-key="Batch_id"
child="school" child-key="batch_id"/>
<sql:relationship
name="batchclass" parent="batch" parent-key="Batch_id"
child="class" child-key="batch_id"/>
<sql:relationship
name="classbooklet" parent="class" parent-key="class_id"
child="booklet" child-key="class_id"/>
<sql:relationship
name="schoolclass" parent="school" parent-key="school_id"
child="class" child-key="school_id"/>
<sql:relationship
name="bookletBookletPage" parent="booklet" parent-
key="book_id" child="booklet_page" child-key="bk_id"/>
<sql:relationship
name="BookletPageScores" parent="booklet_page" parent-
key="bp_id" child="scores" child-key="bp_id"/>
<sql:relationship
name="omrFieldDefScores" parent="OMR_Field_Def" parent-
key="field_id" child="scores" child-key="field_id"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="Root" sql:is-constant="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Batch"
sql:relation="batch">
<xsd:complexType
mixed="true">
<xsd:sequence>
<xsd:element name="Batch_id" type="xsd:string"
sql:key-fields="batch_id"/>
<xsd:element name="Status" type="xsd:string"/>
<xsd:element name="lOriginalBookletCount"
type="xsd:integer" minOccurs="0"/>
<xsd:element name="lOriginalSchoolCount"
type="xsd:integer" minOccurs="0"/>
<xsd:element name="lOriginalClassCount"
type="xsd:integer" minOccurs="0"/>
<xsd:element name="lWIPBookletCount"
type="xsd:integer" minOccurs="0"/>
<xsd:element name="lWIPSchoolCount"
type="xsd:integer" minOccurs="0"/>
<xsd:element name="lWIPClassCount"
type="xsd:integer" minOccurs="0"/>
<xsd:element name="School" sql:relation="school"
sql:relationship="batchschool" sql:key-fields="school_id">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="school_id"
type="xsd:string"/>
<xsd:element name="scanner"
type="xsd:string"/>
<xsd:element name="batch_id"
type="xsd:string"/>
<xsd:element name="status"
type="xsd:string"/>
<xsd:element name="form_id"
type="xsd:string"/>
<xsd:element name="booklet_no"
type="xsd:string"/>
<xsd:element name="gray_image"
type="xsd:string"/>
<xsd:element name="bw_image"
type="xsd:string"/>
<!-- class -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-
- school -->
</xsd:sequence>
<xsd:attribute name="batch_id" type="xsd:string"
use="optional" sql:mapped="false"/>
</xsd:complexType>
</xsd:element>
<!--batch -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!--Root-->
</xsd:schema>
XML Data file:
--------------
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 3 U
(http://www.xmlspy.com) by sandhya (DRC) -->
<Root>
<Batch batch_id="1010">
<Batch_id>1010</Batch_id>
<Status>OMRDone</Status>
<IOriginalBookletCount>2</IOriginalBookletCount>
<IOriginalSchoolCount>1</IOriginalSchoolCount>
<IOriginalClassCount>1</IOriginalClassCount>
<IWIPBookletCount>2</IWIPBookletCount>
<IWIPSchoolCount>1</IWIPSchoolCount>
<IWIPClassCount>1</IWIPClassCount>
<School>
<school_id>110100000000</school_id>
<scanner>1</scanner>
<batch_id>1010</batch_id>
<status>OMRDone</status>
<form_id>520305</form_id>
<booklet_no>000000</booklet_no>
<gray_image>\\IMAGEDEV01
\post_index\split_images\SC520305
\BlankSchool.tif</gray_image>
<bw_image>\\IMAGEDEV01
\post_index\split_images\SC520305
\BlankSchool.tif</bw_image>
</School>
</Batch>
</Root> |