I forgot to include to include the XML yesterday...
I am using the following C#...
SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class loader = new SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class();
loader.ConnectionString = "PROVIDER=SQLOLEDB; Server=(local); database=TestDB; user id=test; password=password";
loader.ErrorLogFile = "C:\log.txt";
loader.SchemaGen = true;
loader.SGDropTables = true;
loader.CheckConstraints = true;
loader.Execute( "C:\xsd.xsd"/* this file below */, "C:\xml.xml" );
To generate tables in the database using the following xml schema... (file: xsd.xsd...)
<?xml version="1.0" standalone="yes"?>
<xs:schema id="PartnerData" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
                                     xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
  <xs:element name="PartnerData">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="MessageHeader">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="SystemName" type="xs:string" minOccurs="0" />
              <xs:element name="CreationDate" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Year" type="xs:string" minOccurs="0" />
                    <xs:element name="Month" type="xs:string" minOccurs="0" />
                    <xs:element name="Day" type="xs:string" minOccurs="0" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="MessageBody">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Product" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Manufacturer" type="xs:string" minOccurs="0" />
                    <xs:element name="Brand" type="xs:string" minOccurs="0" />
                    <xs:element name="LongDescription" type="xs:string" minOccurs="0" />
                    <xs:element name="ShortDescription" type="xs:string" minOccurs="0" />
                    <xs:element name="Category" type="xs:string" minOccurs="0" />
                    <xs:element name="Family" type="xs:string" minOccurs="0" />
                    <xs:element name="ProductCode" type="xs:string" minOccurs="0" />
                    <xs:element name="InformationsUrl" type="xs:string" minOccurs="0" />
                    <xs:element name="PictureUrl" type="xs:string" minOccurs="0" />
                    <xs:element name="PublicationDate" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="Year" type="xs:string" minOccurs="0" />
                          <xs:element name="Month" type="xs:string" minOccurs="0" />
                          <xs:element name="Day" type="xs:string" minOccurs="0" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="RecommendedRetailPrice" nillable="true" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="currency" type="xs:string" />
                            <xs:attribute name="numberOfDecimal" type="xs:string" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="Characteristics" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="Characteristic" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="Label" type="xs:string" minOccurs="0" />
                                <xs:element name="Value" type="xs:string" minOccurs="0" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="Arguments" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="Argument" type="xs:string" minOccurs="0" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="codeEan" type="xs:string" />
                  <xs:attribute name="localisation" type="xs:string" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema
My problems is that it doesn't generate the tables and I am following the SQLXML2.0 documentation as closely as possible.
Does anyone know what I have to do to get it to generate the tables? Running it doesn't even produce an error.
Cheers,
Matt.
 
没有评论:
发表评论