SQL 2005 AND SQLXMLBulkLoad

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rrowles2000

    SQL 2005 AND SQLXMLBulkLoad

    Hi, Am I right in saying that by default, an element of complex type
    in an XSD annotated schema maps to the table with the same name in the
    specified database. If so does anyone have any idea why my app runs
    with no errors, but doesn't add anything to the table in the DB. I was
    hoping to find the value 'GDS-2392265' in the table.

    Any Ideas?
    Thanks in advance.
    Rich


    vb.net code
    -----------------

    Dim objBL
    objBL = CreateObject("S QLXMLBulkLoad.S QLXMLBulkLoad")
    objBL.Connectio nString = "provider=SQLOL EDB.1;data source=xxx
    \SQLEXPRESS;dat abase=xxx;uid=s a;pwd=xxxxx"
    objBL.ErrorLogF ile = "c:\error.l og"
    objBL.KeepIdent ity = False
    objBL.Execute(" c:\SCHEMA.XML", "c:\INPUT.X ML")
    objBL = Nothing

    Me.Enabled = True


    DB Table Def
    -------------------

    CREATE TABLE [dbo].[FeatureCollecti on](
    [fid] [nchar](20) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL
    ) ON [PRIMARY]


    Schema File
    ------------------

    <?xml version="1.0" ?>
    <xsd:schema xmlns="urn:sche mas-microsoft-com:xml-data"
    xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
    xmlns:sql="urn: schemas-microsoft-com:mapping-schema"
    xmlns:osgb="htt p://www.ordnancesur vey.co.uk/xml/namespaces/osgb"
    xmlns:gml="http ://www.opengis.net/gml"
    xmlns:xlink="ht tp://www.w3.org/1999/xlink"
    xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">

    <xsd:element name="FeatureCo llection">
    <xsd:complexTyp e>
    <xsd:attribut e name="fid" type="xsd:strin g"/>
    </xsd:complexType >
    </xsd:element>

    </xsd:schema>


    XML File
    ------------

    <?xml version='1.0' encoding='UTF-8'?>
    <osgb:FeatureCo llection
    xmlns:osgb='htt p://www.ordnancesur vey.co.uk/xml/namespaces/osgb'
    xmlns:gml='http ://www.opengis.net/gml'
    xmlns:xlink='ht tp://www.w3.org/1999/xlink'
    xmlns:xsi='http ://www.w3.org/2001/XMLSchema-instance'
    xsi:schemaLocat ion='http://www.ordnancesur vey.co.uk/xml/namespaces/
    osgb http://www.ordnancesur vey.co.uk/xml/schema/v5/OSDNFFeatures.x sd'
    fid='GDS-2392265'>
    </osgb:FeatureCol lection>

  • Standards Guy

    #2
    Re: SQL 2005 AND SQLXMLBulkLoad

    On Feb 19, 5:02 pm, "rrowles200 0" <rich...@rowles .co.ukwrote:
    Hi, Am I right in saying that by default, an element of complex type
    in an XSD annotated schema maps to the table with the same name in the
    specified database. If so does anyone have any idea why my app runs
    with no errors, but doesn't add anything to the table in the DB. I was
    hoping to find the value 'GDS-2392265' in the table.
    >
    Any Ideas?
    Thanks in advance.
    Rich
    >
    vb.net code
    -----------------
    >
    Dim objBL
    objBL = CreateObject("S QLXMLBulkLoad.S QLXMLBulkLoad")
    objBL.Connectio nString = "provider=SQLOL EDB.1;data source=xxx
    \SQLEXPRESS;dat abase=xxx;uid=s a;pwd=xxxxx"
    objBL.ErrorLogF ile = "c:\error.l og"
    objBL.KeepIdent ity = False
    objBL.Execute(" c:\SCHEMA.XML", "c:\INPUT.X ML")
    objBL = Nothing
    >
    Me.Enabled = True
    >
    DB Table Def
    -------------------
    >
    CREATE TABLE [dbo].[FeatureCollecti on](
    [fid] [nchar](20) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL
    ) ON [PRIMARY]
    >
    Schema File
    ------------------
    >
    <?xml version="1.0" ?>
    <xsd:schema xmlns="urn:sche mas-microsoft-com:xml-data"
    xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
    xmlns:sql="urn: schemas-microsoft-com:mapping-schema"
    xmlns:osgb="htt p://www.ordnancesur vey.co.uk/xml/namespaces/osgb"
    xmlns:gml="http ://www.opengis.net/gml"
    xmlns:xlink="ht tp://www.w3.org/1999/xlink"
    xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
    >
    <xsd:element name="FeatureCo llection">
    <xsd:complexTyp e>
    <xsd:attribut e name="fid" type="xsd:strin g"/>
    </xsd:complexType >
    </xsd:element>
    >
    </xsd:schema>
    >
    XML File
    ------------
    >
    <?xml version='1.0' encoding='UTF-8'?>
    <osgb:FeatureCo llection
    xmlns:osgb='htt p://www.ordnancesur vey.co.uk/xml/namespaces/osgb'
    xmlns:gml='http ://www.opengis.net/gml'
    xmlns:xlink='ht tp://www.w3.org/1999/xlink'
    xmlns:xsi='http ://www.w3.org/2001/XMLSchema-instance'
    xsi:schemaLocat ion='http://www.ordnancesur vey.co.uk/xml/namespaces/
    osgbhttp://www.ordnancesur vey.co.uk/xml/schema/v5/OSDNFFeatures.x sd'
    fid='GDS-2392265'>
    </osgb:FeatureCol lection>
    Hi -

    Got this information from a GML guru. Not sure if it helps, but
    perhaps worth a try:

    Looks like the SQLXMLBulkLoad utility only wants to load the
    "default"
    namespace (i.e. no prefix). So, simply make GML the the default
    namespace:

    <MyFeatureColle ction xmlns="http://www.opengis.org/gml" ... >
    ....
    </MyFeatureCollec tion>

    This way any "unqualifie d" elements are assumed to be in the gml
    namespace and, presumably, SQLXMLBulkLoad would load the data.

    Regards

    Carl

    Comment

    Working...