[dba-VB] Read XML File Using xsd Schema File

Paul Hartland paul.hartland at googlemail.com
Wed Dec 2 10:05:20 CST 2009


To all,

We have been a given what looks to me like a fairly complex XML file, we
have also been given a xsd schema file.  I tried using the SQLXMLBulkLoad
object in VB6 and was getting the error

Schema: relationship expected on 'Company'.

The company that gave us both the files insist that the xsd is correct
(according to my project manager).  I downloaded and installed Stylus Studio
2010, with which I loaded the XML, and then generated my own xsd schame
file.  Tried again and this time get the same error as above, but instead of
'Company' the error was 'Groups'

The VB6 code I am using is as follows:

Dim objBL

Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString = "Provider=SQLOLEDB.1;Password=hermes;Persist
Security Info=True;User ID=sa;Initial Catalog=XLTestCD;Data Source=AL-SQL1"


objBL.KeepIdentity = True

objBL.errorlogfile = "C:\XML_StylusStudio\Error.log"

objBL.checkconstraints = True
objBL.xmlfragment = True
objBL.schemagen = True
objBL.sgdroptables = True

objBL.Execute "C:\XML_StylusStudio\newschema.xsd",
"C:\XML_StylusStudio\CDFull_Original.xml"
Set objBl=Nothing

The object of the exercise being that we generate related tables in SQL
Server 2005 of the XML data.

Would be grateful if anyone could help with this (would be happy to send
example XML file and the schema offline), as I haven't got much hair left to
pull out.

Thanks in advance for any help on this.



-- 
Paul Hartland
paul.hartland at googlemail.com



More information about the dba-VB mailing list