Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML BulkLoad attribute/element issue

Status
Not open for further replies.
Mar 1, 2001
37
US
I'm trying to do a SQl XML Bulk Load. For the example below, I am putting the data in two different table do to the nesting. I got it to work but now I need to add an attribute to the reference section with elements underneath it and I can't get it to work. The the example below, I want to include the attribute in the Cust1 table along with FirstName and LastName. I can get it to work with a attribute with no other elements and vice verse but not with both of them together. Can you do this and if so what am I doing wrong? Thanks.

XML File:
<ROOT>
<Customers>
<CustomerID>1111</CustomerID>
<CompanyName>Parker</CompanyName>
<City1>Woodbury</City1>
<Reference Number="1">
<LastName>Tjepkes</LastName>
<FirstName>Ken</FirstName>
</Reference>
</Customers>
</ROOT>

Schema:
<xsd:schema xmlns:xsd=" xmlns:sql= "urn:schemas-microsoft-com:mapping-schema" >

<xsd:annotation>
<xsd:appinfo>
<sql:relationship name="CompanyReference"
parent="Cust"
parent-key="CustTrID"
child="Cust1"
child-key="CustTrID" />
</xsd:appinfo>
</xsd:annotation>

<xsd:element name="Customers" sql:relation="Cust" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CustomerID" type="xsd:integer" />
<xsd:element name="CompanyName" type="xsd:string" />
<xsd:element name="City1" type="xsd:string" sql:field="City" />
<xsd:element name="Reference" sql:relation="Cust1" sql:relationship="CompanyReference">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LastName" type="xsd:string" />
<xsd:element name="FirstName" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top