Im using Sqlxml 30 with sql 2000 and Visual studio 2003.
if I generate my xmldata file manaually it works fine, However if i
generate it using VisualStudio
using dataset.writexml with ignoreSchema method i get an invalid xml
file.The result is that sql xml creates an empty sql table !
The only difference in the xml file is the following :
<ds xmlns="http://www.tempuri.org/Ds.xsd">
..
</ds>
I presume the xmlns is the namespace stuff but why should its presence
break SQLXML.
Any ideas how to generate the file from the dataset object without this
attribute ?Obviously i am new to this stuff, im trying to get used to using Bulkload
Colin|||You might be able to solve the problem by specifying an annotated schema
that includes the same namespace in the Execute method. If you post your
XML, schema, and code maybe someone can help you out.
Cheers,
Graeme
_____________________
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group
www.contentmaster.com
"Colin Robinson" <colin@.rem_doubleclicksystems.co.uk> wrote in message
news:%23ZNMx1q8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> Obviously i am new to this stuff, im trying to get used to using Bulkload
> Colin
>|||my actual files are two large to post here; but find below the code in
dotnet that should be self explanatory. as i say it works if I edit these
files to look like the Sqlxml samples:
Any assistance would be appreciated here:
'This creates my XML AND XSD files from a dataset dspos
'Me.DsPOS.WriteXml(SaveFileDialog.FileName,
XmlWriteMode.WriteSchema) 'writes with inline schema
'DsPOS.WriteXml("C:\Documents and
Settings\Administrator\Desktop\Updateser
ver.xml", XmlWriteMode.IgnoreSchema)
'writes without inline schema
'Me.DsPOS.WriteXmlSchema(SaveFileDialog.FileName.Replace("xml",
"xsd")) ' Creates the xsd file
'should now have everything i need for sqlxml so ...
'This should bulk load into an existing db named testdb creating the
tables as required
Dim objbl As New Object
objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0")
objbl.ConnectionString = "Provider=SQLOLEDB;Data
Source=(local);Persist Security Info=True;User ID=sa;Initial Catalog=Testdb"
objbl.ErrorLogFile = "C:\Documents and
Settings\Administrator\Desktop\error.log"
objbl.ErrorLogFile = "C:\Documents and
Settings\Administrator\Desktop\Tposerror
.txt"
objbl.CheckConstraints = False
objbl.XMLFragment = False
objbl.SchemaGen = True
objbl.SGDropTables = True
Try
'test with hardcoded filenames
objbl.Execute("C:\Documents and
Settings\Administrator\Desktop\TposSchem
a.xsd", "C:\Documents and
Settings\Administrator\Desktop\Updateser
ver.xml")
Catch ex As Exception
MsgBox(ex.Message)
End Try
objbl = Nothing
MsgBox("Complete")|||Hi Colin
Do you still have a problem? If so let me know and I will get somebody to
look into it.
Best regards
Michael
"Colin Robinson" <z@.x.com> wrote in message
news:%23it6zn28FHA.1188@.TK2MSFTNGP12.phx.gbl...
> my actual files are two large to post here; but find below the code in
> dotnet that should be self explanatory. as i say it works if I edit these
> files to look like the Sqlxml samples:
> Any assistance would be appreciated here:
>
> 'This creates my XML AND XSD files from a dataset dspos
> 'Me.DsPOS.WriteXml(SaveFileDialog.FileName,
> XmlWriteMode.WriteSchema) 'writes with inline schema
> 'DsPOS.WriteXml("C:\Documents and
> Settings\Administrator\Desktop\Updateser
ver.xml",
> XmlWriteMode.IgnoreSchema) 'writes without inline schema
> 'Me.DsPOS.WriteXmlSchema(SaveFileDialog.FileName.Replace("xml",
> "xsd")) ' Creates the xsd file
> 'should now have everything i need for sqlxml so ...
> 'This should bulk load into an existing db named testdb creating
> the tables as required
> Dim objbl As New Object
> objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0")
> objbl.ConnectionString = "Provider=SQLOLEDB;Data
> Source=(local);Persist Security Info=True;User ID=sa;Initial
> Catalog=Testdb"
> objbl.ErrorLogFile = "C:\Documents and
> Settings\Administrator\Desktop\error.log"
> objbl.ErrorLogFile = "C:\Documents and
> Settings\Administrator\Desktop\Tposerror
.txt"
> objbl.CheckConstraints = False
> objbl.XMLFragment = False
> objbl.SchemaGen = True
> objbl.SGDropTables = True
> Try
> 'test with hardcoded filenames
> objbl.Execute("C:\Documents and
> Settings\Administrator\Desktop\TposSchem
a.xsd", "C:\Documents and
> Settings\Administrator\Desktop\Updateser
ver.xml")
> Catch ex As Exception
> MsgBox(ex.Message)
> End Try
> objbl = Nothing
> MsgBox("Complete")
>
>|||thanks its still a problem.
must be something to do with the namespaces in the file headers. when i
execute it it does not error. i think its just not finding valid data to
create even though the xml is well formed.
Colin
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:uItNInQAGHA.1124@.TK2MSFTNGP10.phx.gbl...
> Hi Colin
> Do you still have a problem? If so let me know and I will get somebody to
> look into it.
> Best regards
> Michael
> "Colin Robinson" <z@.x.com> wrote in message
> news:%23it6zn28FHA.1188@.TK2MSFTNGP12.phx.gbl...
>|||The problem was in the headers, I trashed the dotnet headers and replace
with the example header for bulkinsert schema. Did an edit replace to change
the xs: attributes to XSD: and it worked fine inserting 20,000 records in 7
seconds into a new table. Beating dts on the same box
Someone should get the ado net team to talk to the Sqlxml team to export the
xsd in a standard way across microsoft products! Especially relevant with
dotnet and sql being so closely coupled.
"Colin Robinson" <colin@.Doubleclicksystems.co.uk.nospam> wrote in message
news:%23zBglxFDGHA.812@.TK2MSFTNGP10.phx.gbl...
> thanks its still a problem.
> must be something to do with the namespaces in the file headers. when i
> execute it it does not error. i think its just not finding valid data to
> create even though the xml is well formed.
> Colin
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:uItNInQAGHA.1124@.TK2MSFTNGP10.phx.gbl...
>|||Hi Colin
Ahh, good. The problem is that the prefixes should have a namespace uri
associated. The semantics is carried with the namespace URI and not the
prefix (ie xs, xsd).
Thanks for getting back to us with what your problem was though.
Best regards
Michael
"Colin Robinson" <colin@.Doubleclicksystems.co.uk.nospam> wrote in message
news:%235BWvIKDGHA.3748@.TK2MSFTNGP10.phx.gbl...
> The problem was in the headers, I trashed the dotnet headers and replace
> with the example header for bulkinsert schema. Did an edit replace to
> change the xs: attributes to XSD: and it worked fine inserting 20,000
> records in 7 seconds into a new table. Beating dts on the same box
> Someone should get the ado net team to talk to the Sqlxml team to export
> the xsd in a standard way across microsoft products! Especially relevant
> with dotnet and sql being so closely coupled.
> "Colin Robinson" <colin@.Doubleclicksystems.co.uk.nospam> wrote in message
> news:%23zBglxFDGHA.812@.TK2MSFTNGP10.phx.gbl...
>|||Michael.
Can you explain that in more detail then i could probably understad why i
had to make these changes manually. and may be able to overload writeXML
method to generate myself a valid XSD
if i read what you are saying correctly as long as dotnet produces a valid
url/Prefix pair you have a valid xsd. but not one that is compliant with
SQLXML !!!
next questions become
Is there a published resourse of these schemes.
Are there any conversion utils to convert one to the other.
why doesnt MS use the same one for all its products even if its not industry
standard.
and finally It would still be better if some sort of error message pointed
to the problem.
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:uy4VN3ODGHA.1816@.TK2MSFTNGP11.phx.gbl...
> Hi Colin
> Ahh, good. The problem is that the prefixes should have a namespace uri
> associated. The semantics is carried with the namespace URI and not the
> prefix (ie xs, xsd).
> Thanks for getting back to us with what your problem was though.
> Best regards
> Michael
> "Colin Robinson" <colin@.Doubleclicksystems.co.uk.nospam> wrote in message
> news:%235BWvIKDGHA.3748@.TK2MSFTNGP10.phx.gbl...
>|||Hi Colin
You said yourself that you
That means that the generated XSD was fine, but then you changed it. By
doing so you seem to have lost some namespace prefix declarations...
An XML document <mynick:foo xmlns:mynick="uri"/> is the same as
<yournick:foo xmlns:yournick="foo"/> since the namespace prefix only servers
as an alias to the URI.
Every XML Schema however should work to some extend with SQLXML Bulkload
(especially once you have added your annotations).
Best regards
Michael
"Colin Robinson" <colin@.Doubleclicksystems.co.uk.nospam> wrote in message
news:%23Exe0FsDGHA.2956@.TK2MSFTNGP14.phx.gbl...
> Michael.
> Can you explain that in more detail then i could probably understad why i
> had to make these changes manually. and may be able to overload writeXML
> method to generate myself a valid XSD
> if i read what you are saying correctly as long as dotnet produces a valid
> url/Prefix pair you have a valid xsd. but not one that is compliant with
> SQLXML !!!
> next questions become
> Is there a published resourse of these schemes.
> Are there any conversion utils to convert one to the other.
> why doesnt MS use the same one for all its products even if its not
> industry standard.
> and finally It would still be better if some sort of error message
> pointed to the problem.
>
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:uy4VN3ODGHA.1816@.TK2MSFTNGP11.phx.gbl...
>