Re: Please Help: SQLXML Bulk Load Error: Schema: relationship expected on 'Person'
From: Dennis Redfield (dennis.redfield_at_acadia-ins.com)
Date: 03/16/04
- Next message: Paras Wadehra: "Re: Please Help: SQLXML Bulk Load Error: Schema: relationship expected on 'Person'"
- Previous message: CCA Dave: "Re: Error trying books online openxml example"
- In reply to: Jay Murphy: "Please Help: SQLXML Bulk Load Error: Schema: relationship expected on 'Person'"
- Next in thread: Paras Wadehra: "Re: Please Help: SQLXML Bulk Load Error: Schema: relationship expected on 'Person'"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 16 Mar 2004 08:52:43 -0500
try this:
Remove: sql:key-fields="id"
<this is used when your xml document contains data for multiple tables in a
Parent, child relationship>
Add:
dt:type="id"
to your existing:
<xs:attribute name="id" type="xs:string"/>
Add:
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
to your name space declarations within the
xs:schema
element
Try again.
hope this helps.
dlr
"Jay Murphy" <jwmurphy@iname.com> wrote in message
news:be2c9ecb.0403151816.4f76d1c9@posting.google.com...
> Hello,
>
> This is my first time playing with SQLXML and more specifically the
> bulk load features. I've created a very simple case. I'm trying to
> load data from an XML file into a single table called "Person".
> Here's an example of the XML file: The <ScriptObject> tag is
> generated through the XML export feature of an application I use.
>
> <?xml version="1.0" encoding="utf-8"?>
> <ScriptObject itemsName="items" id="0">
> <People>
> <Person id="1">
> <fname>Jane</fname>
> <lname>Smith</lname>
> </Person>
>
> <Person id="2">
> <fname>John</fname>
> <lname>Doe</lname>
> </Person>
>
> </People>
> </ScriptObject>
>
> I created the corresponding schema using "xsd.exe" and then annotated
> it by hand. The following is the annotated schema:
>
> <?xml version="1.0" encoding="utf-8"?>
> <xs:schema id="NewDataSet" xmlns=""
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
> xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
> <xs:element name="ScriptObject">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="People" minOccurs="0" maxOccurs="unbounded"
> sql:is-constant="true">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Person" minOccurs="0"
> maxOccurs="unbounded" sql:relation="Person" sql:key-fields="id">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="fname" type="xs:string"
> minOccurs="0" msdata:Ordinal="0" sql:field="fname"/>
> <xs:element name="lname" type="xs:string"
> minOccurs="0" msdata:Ordinal="1" sql:field="lname"/>
> </xs:sequence>
> <xs:attribute name="id" type="xs:string"
> sql:field="id"/>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> <xs:attribute name="itemsName" type="xs:string" />
> <xs:attribute name="id" type="xs:string" />
> </xs:complexType>
> </xs:element>
> <xs:element name="NewDataSet" msdata:IsDataSet="true"
> sql:is-constant="true">
> <xs:complexType>
> <xs:choice maxOccurs="unbounded">
> <xs:element ref="ScriptObject" />
> </xs:choice>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> I realize that many of the "relation" and "field" mappings are
> generated by default however, I wanted to be explicit in order to
> illustrate the problem. I'm trying to load the data with the
> following C# program:
>
> using System;
>
> namespace bl
> {
> class Class1
> {
> [STAThread]
> static void Main(string[] args)
> {
> try
> {
> SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class objBL = new
> SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class();
> objBL.ConnectionString =
> "Provider=sqloledb;server=server;database=sample;integrated
> security=SSPI";
> objBL.ErrorLogFile = "error.xml";
> objBL.KeepIdentity = false;
> objBL.Execute ("schema.xsd","data.xml");
> }
> catch(Exception e)
> {
> Console.WriteLine(e.ToString());
> }
> }
> }
> }
>
> However, I encounter the following error:
>
> Schema: relationship expected on 'Person'
>
> I've read the documentation for sql:relationship and I'm scratching my
> head because in my situation there's only the single table "Person".
> No parent, child or foreign key relationships.
>
> I must be overlooking something simple. What am I doing wrong?
>
> Thanks so much,
> Jay Murphy
- Next message: Paras Wadehra: "Re: Please Help: SQLXML Bulk Load Error: Schema: relationship expected on 'Person'"
- Previous message: CCA Dave: "Re: Error trying books online openxml example"
- In reply to: Jay Murphy: "Please Help: SQLXML Bulk Load Error: Schema: relationship expected on 'Person'"
- Next in thread: Paras Wadehra: "Re: Please Help: SQLXML Bulk Load Error: Schema: relationship expected on 'Person'"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|