Xml Bulk Load in SQL 2000 relationship error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mharrison
    New Member
    • Nov 2006
    • 26

    Xml Bulk Load in SQL 2000 relationship error

    Hi All,

    I'm using SQL 2000 and in a DTS I want to load in an error XML file to a SQL table.

    I am using the SQLXMLBulkLoad component in an Active X script.

    I have an XML file. see below, and also an XSD schema file. Could someone take a look and see where I am going wrong??!

    I get an error from SQL stating "Relationsh ip expected on errors"

    I need simply the contents of each error_msg tag to populate a field called errormsg in a table called Error_Response table

    ## START SCHEMA
    [HTML]<?xml version="1.0" encoding="utf-8"?>
    <xs:schema attributeFormDe fault="unqualif ied" elementFormDefa ult="qualified" xmlns:dt="urn:s chemas-microsoft-com:xml:datatyp es" targetNamespace ="mytargetnames pace.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn: schemas-microsoft-com:mapping-schema">
    <xs:element name="stockorde r_error" >
    <xs:complexType >
    <xs:sequence>
    <xs:element name="errors" >
    <xs:complexType >
    <xs:sequence>
    <xs:element name="error" sql:relation="E rror_Response">
    <xs:complexType >
    <xs:sequence>
    <xs:element name="error_mes sage" sql:field="erro rmsg" type="xs:string " />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="version" type="xs:string " use="required" />
    </xs:complexType>
    </xs:element>
    </xs:schema>[/HTML]
    ## END SCHEMA

    ## START XML FILE
    [HTML]
    <?xml version="1.0" ?>
    <stockorder_err or xmlns="mytarget namespace.com" version="1a" >
    <errors>
    <error>
    <error_message> This is an error</error_message>
    </error>
    </errors>
    </stockorder_erro r>[/HTML]
    ## END XML FILE

    Thanks

    mh
  • mharrison
    New Member
    • Nov 2006
    • 26

    #2
    Found the issue

    I changed from an XSD to XDR schema

    and used the following:

    [HTML]<?xml version="1.0" ?>
    <Schema xmlns="urn:sche mas-microsoft-com:xml-data"
    xmlns:dt="urn:s chemas-microsoft-com:xml:datatyp es"
    xmlns:sql="urn: schemas-microsoft-com:xml-sql"
    sql:target-namespace="myta rgetnamespace">


    <ElementType name="stockorde r_error" dt:type="string " sql:is-constant="1">
    <AttributeTyp e name="xmlns" required="no" dt:type="string "/>
    <AttributeTyp e name="version" required="no" dt:type="string "/>
    </ElementType>

    <ElementType name="error_mes sage" dt:type="string " />

    <ElementType name="error" sql:relation="E rror_Response">
    <element type="error_mes sage" sql:field="erro rmsg" />

    </ElementType>

    </Schema>[/HTML]

    behind the times for schemas I know, but least i got it working!

    Comment

    Working...