473,395 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Converting XML > Dataset

Hi !

Here's my problem in english :-)

I want to convert the mssecure.xml file from Microsoft into an dataset to
store it in an SQL-Database.
My code in VB looks like this :

Dim ds As New DataSet
Dim doc As New Xml.XmlDocument
doc.Load("D:\mssecure.xml")
Dim sReader As New StringReader(doc.InnerXml)
ds.ReadXml(sReader)

The problem is : At the ds.readxml(sreader) command i get an error which
told me, that there is an problem whith a relationship in "ProductFamilies"

I hope my english is good enough to explain...

Please help !

Thanks !!!

Christoph Duesmann

Nov 12 '05 #1
6 5523
Christoph Duesmann wrote:
Dim ds As New DataSet
Dim doc As New Xml.XmlDocument
doc.Load("D:\mssecure.xml")
Dim sReader As New StringReader(doc.InnerXml)
ds.ReadXml(sReader)


That's weird. You load XML into XmlDocument, then serialize back to
string and read that string to DataSet? Why not just

ds.ReadXml("D:\mssecure.xml")

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
Hi Oleg !
That's weird. You load XML into XmlDocument, then serialize back to string
and read that string to DataSet? Why not just

ds.ReadXml("D:\mssecure.xml")


I tried it but i get the same Error-Message during debugging.
Try it yourself, to bind the mssecure.xml into an Dataset

Thank for your next answer :-)

christoph

Nov 12 '05 #3
Christoph Duesmann wrote:
That's weird. You load XML into XmlDocument, then serialize back to string
and read that string to DataSet? Why not just

ds.ReadXml("D:\mssecure.xml")

I tried it but i get the same Error-Message during debugging.
Try it yourself, to bind the mssecure.xml into an Dataset


Oh, you mean the mssecure.xml? :)

I believe you can't load it to DataSet. Its schema is a recursive one
and DataSet can only handle relational schemas. But I may be wrong.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #4
Hi Oleg !

I believe you can't load it to DataSet. Its schema is a recursive one and
DataSet can only handle relational schemas. But I may be wrong.


If a dataset doesn't work : What would you do store the xml-Data (like
Patchname, downloadlocation etc) in an Database ?

Thanks !

Christoph

Nov 12 '05 #5
Idea : If i remove the ProductFamilies Section from the xml document then
databinding functions correct !!!
Now tell me how to remove this section programmaticly...

This is the section :

<ProductFamilies>
<ProductFamily ProductFamilyID="1" Name="Windows NT"
RecentProductVersionID=""/>
<ProductFamily ProductFamilyID="2" Name="Windows 2000"
RecentProductVersionID=""/>
<ProductFamily ProductFamilyID="3" Name="Windows 9x"
RecentProductVersionID=""/>
<ProductFamily ProductFamilyID="4" Name="Windows XP"
RecentProductVersionID=""/>
...
...
...
</ProductFamilies>

thanks

Christoph

Nov 12 '05 #6
"Christoph Duesmann" <c.********@web.de> wrote in message
news:uh****************@TK2MSFTNGP15.phx.gbl...
Idea : If i remove the ProductFamilies Section from the xml document then
databinding functions correct !!!
Now tell me how to remove this section programmaticly...

This is the section :

<ProductFamilies>
...
</ProductFamilies>


One way you can remove the <ProductFamilies> element programmatically is to
use an XSLT transform like this:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- the identity transform -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*/>
</xsl:copy>
</xsl:template>

<!-- discard the ProductFamilies element and its children -->
<xsl:template match="ProductFamilies"/>

</xsl:transform>

Alternately, you could load the XML into an XmlDocument and remove the
offending element, or

Cheers,
Stuart Celarier, Fern Creek
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: thomas | last post by:
I must be doing something obvious wrong here, but: I perform a query to retrieve a dataset - I want to archive this in a SQL field for seperate retrieval later, while the original data may have...
8
by: ASP Yaboh | last post by:
I have an ArrayList of data gathered from a database. I want to create a web page from this data by creating a <table>, each cell in each row displays the appropriate data. One of those cells in...
1
by: Ramakrishnan Nagarajan | last post by:
Hi, I am converting Excel data into a Dataset in C#. There are around 24 columns in the Excel Sheet. First I tried to insert one row with correct values in the Excel sheet. i.e. for text columns...
6
by: Ramakrishnan Nagarajan | last post by:
Hi can any one help me in converting a DataView into a DataSet or a DataTable into a DataSet, I tried the following ways dSet= ((DataSet)_gridRegStudDetails.DataSource); dSet =...
3
by: Parvesh | last post by:
hi, I am using a webservice which Returns the Result in an XML string, The XML response i get i svery cumbersome to parse, But if i could convert it to the Corresponding Class using the...
5
by: David Harris | last post by:
I am developing a type of data warehouse. Basically, we have 20 client survey machines that are each separated from the server by space and lack of network. Yet both need to speak to each other...
2
by: ilyagzak | last post by:
Hi, I have a dataset that I am trying to convert to xmldocument. I get a message: "The path is too long after being fully qualified. Make sure path is less than 260 characters." My code is...
21
by: py_genetic | last post by:
Hello, I'm importing large text files of data using csv. I would like to add some more auto sensing abilities. I'm considing sampling the data file and doing some fuzzy logic scoring on the...
0
by: =?Utf-8?B?TXlMYWJSdWJ5?= | last post by:
I am developing an application that will be able to be used offline from the SQL server and am trying to come up with a good way to do this. My thought at this moment is to basically work "offline"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.