You are here: SQL 2005 AND SQLXMLBulkLoad « MsSQL Server « IT news, forums, messages
SQL 2005 AND SQLXMLBulkLoad

Posted by richard on 02/17/07 14:30

Hi,

I'm using 2005 and SQLXMLBulkLoad to load some rather large gml
files.
But I've got a problem (I Think) with specifying different
namespaces.
I'm a bit new to all this so your patience is appreciated.


Basically if I go through the XML file I'm loading and delete all
references to the 'gml:' namespace my schema works, and lots of
records are added to the database. If I use the original file with
references to the 'gml:' namespace I get no error and no records.


Any help would be greatly appreciated
Thanks in advance
Rich


vb.net code which appears to work ok.
--------------------------------------------------------


objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString = "provider=SQLOLEDB.1;data
source=MY_SERVER\SQLEXPRESS;database=MY_DB;uid=xxx;pwd=xxxx"
objBL.ErrorLogFile = "c:\error.log"
objBL.KeepIdentity = False
objBL.Execute("c:\MMAP_SCHEMA_FINAL.XML", "c:\MMAP.XML")
objBL = Nothing


Mapping Schema
-------------------------


<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql"
xmlns:osgb="http://www.ordnancesurvey.co.uk/xml/namespaces/
osgb"
xmlns:gml="http://www.opengis.net/gml">


<ElementType name="FeatureCollection" sql:is-constant="1"/>
<AttributeType name="fid" dt:type="string"/>


<ElementType name="TopographicPoint" sql:relation="MY_TABLE">
<attribute type="fid" sql:field="OS_ID" />
</ElementType>


</Schema>


Sample XML That works
-----------------------------------


<?xml version='1.0' encoding='UTF-8'?>
<FeatureCollection
xmlns:osgb='http://www.ordnancesurvey.co.uk/xml/namespaces/osgb'
xmlns:gml='http://www.opengis.net/gml'
xmlns:xlink='http://www.w3.org/1999/xlink'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.ordnancesurvey.co.uk/xml/namespaces/
osgb http://www.ordnancesurvey.co.uk/xml/schema/v5/OSDNFFeatures.xsd'
fid='GDS-2386515'>
<gml:description>Ordnance Survey, (c) Crown Copyright. All rights
reserved, 2006-11-19</gml:description>
<gml:boundedBy><gml:null>unknown</gml:null></gml:boundedBy>
<osgb:queryTime>2006-11-19T12:34:23</osgb:queryTime>
<osgb:queryExtent>
<osgb:Rectangle srsName='osgb:BNG'>
<gml:coordinates>445000.000,1200000.000 450000.000,1205000.000</
gml:coordinates>
</osgb:Rectangle>
</osgb:queryExtent>
<osgb:topographicMember>
<TopographicPoint fid='osgb1000000042059081'>
<osgb:featureCode>10186</osgb:featureCode>
<osgb:version>1</osgb:version>
<osgb:versionDate>2001-11-12</osgb:versionDate>
<osgb:theme>Structures</osgb:theme>
<osgb:accuracyOfPosition>1.0m</osgb:accuracyOfPosition>
<osgb:changeHistory>
<osgb:changeDate>1994-11-25</osgb:changeDate>
<osgb:reasonForChange>New</osgb:reasonForChange>
</osgb:changeHistory>
<osgb:descriptiveGroup>Structure</osgb:descriptiveGroup>
<osgb:descriptiveTerm>Triangulation Point Or Pillar</
osgb:descriptiveTerm>
<osgb:make>Manmade</osgb:make>
<osgb:physicalLevel>50</osgb:physicalLevel>
<osgb:point>
<gml:Point srsName='osgb:BNG'>
<gml:coordinates>448184.500,1204872.500</gml:coordinates>
</gml:Point>
</osgb:point>
</TopographicPoint>
.........


Sample XML that does NOT work (but this is how I would like to load
it)
---------------------------------------------------------------------------­--------------------------


<?xml version='1.0' encoding='UTF-8'?>
<osgb:FeatureCollection
xmlns:osgb='http://www.ordnancesurvey.co.uk/xml/namespaces/osgb'
xmlns:gml='http://www.opengis.net/gml'
xmlns:xlink='http://www.w3.org/1999/xlink'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.ordnancesurvey.co.uk/xml/namespaces/
osgb http://www.ordnancesurvey.co.uk/xml/schema/v5/OSDNFFeatures.xsd'
fid='GDS-2386515'>
<gml:description>Ordnance Survey, (c) Crown Copyright. All rights
reserved, 2006-11-19</gml:description>
<gml:boundedBy><gml:null>unknown</gml:null></gml:boundedBy>
<osgb:queryTime>2006-11-19T12:34:23</osgb:queryTime>
<osgb:queryExtent>
<osgb:Rectangle srsName='osgb:BNG'>
<gml:coordinates>445000.000,1200000.000 450000.000,1205000.000</
gml:coordinates>
</osgb:Rectangle>
</osgb:queryExtent>
<osgb:topographicMember>
<osgb:TopographicPoint fid='osgb1000000042059081'>
<osgb:featureCode>10186</osgb:featureCode>
<osgb:version>1</osgb:version>
<osgb:versionDate>2001-11-12</osgb:versionDate>
<osgb:theme>Structures</osgb:theme>
<osgb:accuracyOfPosition>1.0m</osgb:accuracyOfPosition>
<osgb:changeHistory>
<osgb:changeDate>1994-11-25</osgb:changeDate>
<osgb:reasonForChange>New</osgb:reasonForChange>
</osgb:changeHistory>
<osgb:descriptiveGroup>Structure</osgb:descriptiveGroup>
<osgb:descriptiveTerm>Triangulation Point Or Pillar</
osgb:descriptiveTerm>
<osgb:make>Manmade</osgb:make>
<osgb:physicalLevel>50</osgb:physicalLevel>
<osgb:point>
<gml:Point srsName='osgb:BNG'>
<gml:coordinates>448184.500,1204872.500</gml:coordinates>
</gml:Point>
</osgb:point>
</osgb:TopographicPoint>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация