473,791 Members | 3,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlDataDocument problem

Hi,

I have a problem reading xml into a dataset using the XmlDataDocument .
In a test project, I created the following xml file:

<?xml version="1.0" standalone="yes "?>
<Customer>
<OrderDetails >
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>

And I use the following code to read it:

TestDataSet ds = new TestDataSet(); // TestDataSet is a typed dataset
with 1 table "OrderDetai ls", with 1 column "OrderID"
System.Xml.XmlD ataDocument doc = new System.Xml.XmlD ataDocument(ds) ;
doc.Load("Test. xml");

foreach (TestDataSet.Or derDetailsRow row in ds.OrderDetails )
{
Console.WriteLi ne(row.OrderID) ;
}

ds.OrderDetails always has a rowcount of 0.

It works when I change the xml to this:

<?xml version="1.0" standalone="yes "?>
<DataSet xmlns="http://tempuri.org/TestDataSet.xsd ">
<Customer>
<OrderDetails >
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>
</DataSet>

I used this article to create my test project:
http://msdn2.microsoft.com/en-us/lib...13(VS.80).aspx and I
see no "<DataSet xmlns="http://tempuri.org/TestDataSet.xsd ">" line in
the example xml there

May 9 '07 #1
3 4356
Hi,

I have a problem reading xml into a dataset using the XmlDataDocument .
In a test project, I created the following xml file:

<?xml version="1.0" standalone="yes "?>
<Customer>
<OrderDetails >
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>

And I use the following code to read it:

TestDataSet ds = new TestDataSet(); // TestDataSet is a typed dataset
with 1 table "OrderDetai ls", with 1 column "OrderID"
System.Xml.XmlD ataDocument doc = new System.Xml.XmlD ataDocument(ds) ;
doc.Load("Test. xml");

foreach (TestDataSet.Or derDetailsRow row in ds.OrderDetails )
{
Console.WriteLi ne(row.OrderID) ;
}

ds.OrderDetails always has a rowcount of 0.

It works when I change the xml to this:

<?xml version="1.0" standalone="yes "?>
<DataSet xmlns="http://tempuri.org/TestDataSet.xsd ">
<Customer>
<OrderDetails >
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>
</DataSet>

I used this article to create my test project:
http://msdn2.microsoft.com/en-us/lib...13(VS.80).aspx and I
see no "<DataSet xmlns="http://tempuri.org/TestDataSet.xsd ">" line in
the example xml there

Please give me advice how I write the code for use the string as the input. How to create a function that takes a string and outputs a Dataset. Please if you can give me cods because I am trying but get nothing. Providing you cods below down where I stuck.

Rgards

Maninder Singh
BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
May 25 '07 #2
Hi,

I have a problem reading xml into a dataset using the XmlDataDocument .
In a test project, I created the following xml file:

<?xml version="1.0" standalone="yes "?>
<Customer>
<OrderDetails >
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>

And I use the following code to read it:

TestDataSet ds = new TestDataSet(); // TestDataSet is a typed dataset
with 1 table "OrderDetai ls", with 1 column "OrderID"
System.Xml.XmlD ataDocument doc = new System.Xml.XmlD ataDocument(ds) ;
doc.Load("Test. xml");

foreach (TestDataSet.Or derDetailsRow row in ds.OrderDetails )
{
Console.WriteLi ne(row.OrderID) ;
}

ds.OrderDetails always has a rowcount of 0.

It works when I change the xml to this:

<?xml version="1.0" standalone="yes "?>
<DataSet xmlns="http://tempuri.org/TestDataSet.xsd ">
<Customer>
<OrderDetails >
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>
</DataSet>

I used this article to create my test project:
http://msdn2.microsoft.com/en-us/lib...13(VS.80).aspx and I
see no "<DataSet xmlns="http://tempuri.org/TestDataSet.xsd ">" line in
the example xml there
Please give me advice how I write the code for use the string as the input. How to create a function that takes a string and outputs a Dataset. Please if you can give me cods because I am trying but get nothing. Providing you cods below down where I stuck.

Rgards

Maninder Singh
BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
May 25 '07 #3
Hi,

I have a problem reading xml into a dataset using the XmlDataDocument .
In a test project, I created the following xml file:

<?xml version="1.0" standalone="yes "?>
<Customer>
<OrderDetails >
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>

And I use the following code to read it:

TestDataSet ds = new TestDataSet(); // TestDataSet is a typed dataset
with 1 table "OrderDetai ls", with 1 column "OrderID"
System.Xml.XmlD ataDocument doc = new System.Xml.XmlD ataDocument(ds) ;
doc.Load("Test. xml");

foreach (TestDataSet.Or derDetailsRow row in ds.OrderDetails )
{
Console.WriteLi ne(row.OrderID) ;
}

ds.OrderDetails always has a rowcount of 0.

It works when I change the xml to this:

<?xml version="1.0" standalone="yes "?>
<DataSet xmlns="http://tempuri.org/TestDataSet.xsd ">
<Customer>
<OrderDetails >
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>
</DataSet>

I used this article to create my test project:
http://msdn2.microsoft.com/en-us/lib...13(VS.80).aspx and I
see no "<DataSet xmlns="http://tempuri.org/TestDataSet.xsd ">" line in
the example xml there
Dataset ds = CreateFromStrin g(xml);

BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
May 25 '07 #4

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

Similar topics

1
1324
by: Mathew Relick | last post by:
I'm relatively new to this sort of thing, so forgive me if this is completely off base, but I'm having a problem getting the XMLDataDocument to do what I need it to. I have a small test application that has a DataSet with two data tables, Person and Home. I've setup Home as a child of Person. What I want to do is to load data into these two tables, and then have the data document create the xml with the child nodes (home) nested under...
2
5488
by: Anas M. Nebuchadnezzar XXXVII | last post by:
I am loading an Xml file from a sql server. I have one field that contains child nodes stored as text. The problem is, when I try to imort the dataset into a XmlDataDocument, it loads the whole thing as a text element. (with all of the special characters converted) The best solution I've found so far is to do a string replace on all of the special characters. Like so: DataSet ds = new DataSet(); ds.EnforceConstraints = false;...
3
6574
by: Henrik K | last post by:
Selecting element nodes from a xmlDataDocument using the childNodes collection or by using selectSingleNode and then reading innerXml or outerXml leaks cpu-resources. A trivial example showing this behaviour is included below. Running this example increases the cpu-load gradually and reaches 100% within a minute or two. The problem exists with innerXml as well as outerXml operations. Using a xmlDocument instead of a xmlDataDocument...
0
1171
by: Mathew Relick | last post by:
I'm relatively new to this sort of thing, so forgive me if this is completely off base, but I'm having a problem getting the XMLDataDocument to do what I need it to. I have a small test application that has a DataSet with two data tables, Person and Home. I've setup Home as a child of Person. What I want to do is to load data into these two tables, and then have the data document create the xml with the child nodes (home) nested under...
0
2157
by: gilly3 | last post by:
Reposting to a more relevant group. I am passing a generic dataset into a new XMLDataDocument and then parsing the XML with XSLT. The idea being that I can parse any dataset with the same xslt, and dynamically generate an html table. The problem is when the DataSet contains a null value, the node for that record is not created. Then when the xml parses it, there are too few cells in some of the table rows. I can think of a couple...
2
3905
by: James Ankrom | last post by:
Why does this fail? Dim relResources As New Data.DataRelation("Application_Resources", ..Tables("User_Applications").Columns("Application_id"), ..Tables("Resource_Rights").Columns("Application_id"), False) mUserData.Relations.Add(relResources) relResources.Nested = True Dim UserDataXML As System.Xml.XmlDataDocument = New System.Xml.XmlDataDocument(mUserData)
0
1431
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
4
8279
by: Adrian Meyer | last post by:
Hi, On the server I code the following web service: ))] public XmlDataDocument GetTypedXmlDataDocument() { sqlDataAdapter1.Fill(typedDataSet1); XmlDataDocument dataDoc
2
5856
by: ERingmae | last post by:
Hi, The environment is .NET 2.0, the language is C# and the problem is reading XSD file with xs:redefine section correctly to a XMLDataDocument.DataSet. What I am trying to do: I am trying to create a DataSet object from an XSD file by using XMLDataDocument class.
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10207
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...
1
10156
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9030
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
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
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.