What did I miss? XML bulk load
Hello everyone,
Cannot I bulk load the following?
<Customer id = ¡°John¡±>
<city>New York</city>
<order id =o123 />
<order id =o124 />
</Customer >
<Customer id = ¡°Tom¡±>
<city>LA</city>
<order id =o125 />
<order id =o126 />
</Customer >
I believe it¡¯s a common problem, anybody may encounter it.
Well, it¡¯s a simple relationship, each customer can place many order,
Use XML bulk load to insert it into two tables: Customer & Order
Bulk load is working on kind of ¡°scan-based¡± mode,
At </order>, it will insert to the order table, it need the customer¡¯s
id as its foreign key, however, the customer id has not defined at
that point of the time. It¡¯s an attribute, not a subelement of the
product, THE ATTRIBUTE HAVE TO BE FOLLOWED BY
</xsd:sequence>. That means the order element has to be ahead
of customer id which is a key info order element need to get?
<xsd:element name="Customer" sql:relation="Cust">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="city" type="xsd:string" />
<xsd:element name="order" >
<xsd:complexType>
<xsd:attribute name="ID"
sql:relation="order"
sql:relationship="custorder"
type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="ID" type="xsd:string" />
</xsd:complexType>
</xsd:element>
error message: the relationship custorder referred to in the node 'ID' is
not defined
|