473,789 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:\ms secure.xml")
Dim sReader As New StringReader(do c.InnerXml)
ds.ReadXml(sRea der)

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

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

Please help !

Thanks !!!

Christoph Duesmann

Nov 12 '05 #1
6 5540
Christoph Duesmann wrote:
Dim ds As New DataSet
Dim doc As New Xml.XmlDocument
doc.Load("D:\ms secure.xml")
Dim sReader As New StringReader(do c.InnerXml)
ds.ReadXml(sRea der)


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, downloadlocatio n 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 :

<ProductFamilie s>
<ProductFamil y ProductFamilyID ="1" Name="Windows NT"
RecentProductVe rsionID=""/>
<ProductFamil y ProductFamilyID ="2" Name="Windows 2000"
RecentProductVe rsionID=""/>
<ProductFamil y ProductFamilyID ="3" Name="Windows 9x"
RecentProductVe rsionID=""/>
<ProductFamil y ProductFamilyID ="4" Name="Windows XP"
RecentProductVe rsionID=""/>
...
...
...
</ProductFamilies >

thanks

Christoph

Nov 12 '05 #6
"Christoph Duesmann" <c.********@web .de> wrote in message
news:uh******** ********@TK2MSF TNGP15.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 :

<ProductFamilie s>
...
</ProductFamilies >


One way you can remove the <ProductFamilie s> element programmaticall y is to
use an XSLT transform like this:

<xsl:transfor m 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="ProductF amilies"/>

</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
1030
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 moved on - so I write it to a string of XML using ds.GetXML(). I then write that string to the DB, into 1 'text' type field. (I know the data will never get over a certain size) Later I read that field and retrieve the data as a string and...
8
2275
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 each row needs a <textarea> control. The background supporting classes are completed, the only task left now is to create the web page. I am at a loss on how to create the table in the page populated by the data. Previously, I would have just...
1
2653
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 I entered text values and for numeric columns I entered numeric values. It works fine and pass through all the validation checks and gets inserted into the database successfully. But when I gave some junk values in the excel sheet and tried to...
6
23322
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 = ((DataSet)_gridRegStudDetails.DataSource).Tables.DataSet; studData = ((DataSet)dView).Tables.DataSet; But not working can you pls help me out
3
2473
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 System.Xml.Serialization, i think that can solve my problem. But i tried using the Deserialize method for converting the XML to the Corresponding Object, neither i get error nor i get any luck for converting it to Object.
5
1434
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 such that the clients know the latest configuration information and the server contains completed survey data from the clients. Currently I'm accomplishing this by using a few special database tables to control the flow of information, and using XML...
2
1781
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 very simple: Dim ds As DataSet ds = ws.get_POItemsDS("504393") '-- dataset is populated here
21
2024
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 attributes (colls in a data base/ csv file, eg. height weight income etc.) to determine the most efficient 'type' to convert the attribute coll into for further processing and efficient storage... Example row from sampled file data: , ....]
0
1193
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" all the time and sync on a regular basis when connected. To do this, I have written several procedures to load and save data from the database and an XML file. However, when I load the informatiom from the XML file and then try to save it to...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.