Re: SQL data to XML



I assume that the XML looks like you want, except for the DTD?

You can use the ADO or ADO.net providers to get the XML back (see books
online for examples) and then save the XML programmatically into a file. If
you want to add the DOCTYPE, you add it to the file before you add the
returned XML.

HTH
Michael

"HSalim[MVP]" <HSalim@xxxxxxx> wrote in message
news:%23ZVU6k3oGHA.1796@xxxxxxxxxxxxxxxxxxxxxxx


Hi,
I am helping a customer move data into NetSuite.
My knowledge of XML is sketchy; it has improved from almost nothing since
I
started on this project.

I have a query ready to extract data, which I have rewritten using sample
data from the adventureworks database.
(pated below)

How do I save the output of this query to a file?
How do I add a reference to the DTD?
<!DOCTYPE smbxml SYSTEM "http://www.netsuite.com/xml/dtd/smb_5_01.dtd";>

What I'm doing for now is that I run the query in SQL MAnagement Studio,
manually paste the xml header and DTD lines and save it to a file. Surely
there must be a few ways that are better?

Ideally, I'd like to use VBScript - I'd have a shortcut that I would
execute, vbscript prompts for output filename and that's that
(I'll be using integrated security)

I started reading about XSL trnsformations and I still havent grasped it
well enough to apply it to what I need to get done.
I know there is the XML DOM, but I know nothing about it either. Should I
look more into the XML DOM?

Any advice, sample code and pointers to resources would be helpful.
Thanks
in advnace for the assistance.

Regards
Habib
------------sample query ------------------------
select (
select rtrim(C.CustomerID) as [@handle]
,(select
(select
CustomerID as [@handle]
, TerritoryID as [territory]
, AccountNumber as [accountNumber]
, CustomerType as [customerType]
, rowguid as [rowGuid]
, convert( char(10),ModifiedDate, 101) as [modifiedDate]
, (Select AddressID as [addressRef/name]
, AddressTypeID as [addressType/name]
, convert( char(10),ModifiedDate, 101) as [modifiedDate]
from sales.customerAddress
where CustomerID = C.CustomerID
for XML PATH('AddressLine'), TYPE ) as [AddressList]
for XML PATH ('customer'), type)
for XML PATH ('addOrUpdate'), type)
from sales.Customer C
where customerID < 5
for XML PATH ('request'), type)
for XML PATH ('smbXML'), type






.



Relevant Pages

  • Re: Lets think who will like to say delphi is dying?
    ... if that particular DTD rules it out. ... there are 2 basic usage forms for XML. ... HTML is/canbe quite strict too. ... Parsing and compiling are kind of the same thing.. ...
    (borland.public.delphi.non-technical)
  • Re: standalone validating XML parser for Solaris?
    ... the unix command line to validate large XML files against an XML DTD. ... Older versions only parse but dont validate. ... More recent versions can validate against DTD or Schema. ...
    (comp.text.xml)
  • Re: DTD in browsers
    ... statement that "DTD for XML are always fetched" is totally correct. ... It is definitely fetched by XML parsers in known Web ... I just presume that Thomas was not aware of the current bug in Gecko ... agree that there is only one DOCTYPE and only one DTD mechanics equal ...
    (comp.infosystems.www.authoring.html)
  • Re: A new paradigm
    ... AccuTerm GUI application for the WinDoze types and a ... With Coyote and a finished XML project, I'm sure that all of that could ... Tom H has taken over the DTD stuff recently ... XML-based development under OpenQM should take part in discussions on the ...
    (comp.databases.pick)
  • How to skip validation of DTD file on VB.Net when the DTD is offline
    ... OK - I have an XML file from a vendor that uses a DTD files as follows: ... A connection attempt failed because ... connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& ...
    (microsoft.public.dotnet.languages.vb)

Loading