Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Saving XML data into a table

I am getting an XML file as a response from a post onto a site. Now I need
to save the data in the file onto a table... There are many tags and elements
in the file which is of no use to me... I need to save a few tag values...
onto corresponding columns in a table... Is there a way to selectively iterate
through the XML tree and save the data to a table... I am using SQL Server
2000. Need help urgently.

Thanks,

Prasanna
[462 byte] By [Prasanna] at [2007-11-9 15:27:23]
# 1 Re: Saving XML data into a table
You can either iterate through the posted document using a SAX parser, or
you can use XPath queries to extract only the values you want. Which one
will be the easiest to implement or the most efficient depends on the size
of the posted document, the number of data values you want to extract, and
their dependence on other values in the document.

"Prasanna" <prasu_kv@yahoo.com> wrote in message
news:3dda51fa$1@tnews.web.dev-archive.com...
>
> I am getting an XML file as a response from a post onto a site. Now I need
> to save the data in the file onto a table... There are many tags and
elements
> in the file which is of no use to me... I need to save a few tag values...
> onto corresponding columns in a table... Is there a way to selectively
iterate
> through the XML tree and save the data to a table... I am using SQL Server
> 2000. Need help urgently.
>
> Thanks,
>
> Prasanna
Russell Jones at 2007-11-11 23:29:48 >
# 2 Re: Saving XML data into a table
Transform the xml using xsl into an xml representation that matches your
tables. The xsl would only process what you tell it to and the end result
would be only what you want. Then, all you application would have to do is
take the new xml and do a one to one post to the tables.

"Prasanna" <prasu_kv@yahoo.com> wrote in message
news:3dda51fa$1@tnews.web.dev-archive.com...
>
> I am getting an XML file as a response from a post onto a site. Now I need
> to save the data in the file onto a table... There are many tags and
elements
> in the file which is of no use to me... I need to save a few tag values...
> onto corresponding columns in a table... Is there a way to selectively
iterate
> through the XML tree and save the data to a table... I am using SQL Server
> 2000. Need help urgently.
>
> Thanks,
>
> Prasanna
Michael Gautier at 2007-11-11 23:30:53 >