473,394 Members | 2,071 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,394 software developers and data experts.

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 "OrderDetails", with 1 column "OrderID"
System.Xml.XmlDataDocument doc = new System.Xml.XmlDataDocument(ds);
doc.Load("Test.xml");

foreach (TestDataSet.OrderDetailsRow row in ds.OrderDetails)
{
Console.WriteLine(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 4336
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 "OrderDetails", with 1 column "OrderID"
System.Xml.XmlDataDocument doc = new System.Xml.XmlDataDocument(ds);
doc.Load("Test.xml");

foreach (TestDataSet.OrderDetailsRow row in ds.OrderDetails)
{
Console.WriteLine(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 "OrderDetails", with 1 column "OrderID"
System.Xml.XmlDataDocument doc = new System.Xml.XmlDataDocument(ds);
doc.Load("Test.xml");

foreach (TestDataSet.OrderDetailsRow row in ds.OrderDetails)
{
Console.WriteLine(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 "OrderDetails", with 1 column "OrderID"
System.Xml.XmlDataDocument doc = new System.Xml.XmlDataDocument(ds);
doc.Load("Test.xml");

foreach (TestDataSet.OrderDetailsRow row in ds.OrderDetails)
{
Console.WriteLine(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 = CreateFromString(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
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...
2
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...
3
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...
0
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...
0
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,...
2
by: James Ankrom | last post by:
Why does this fail? Dim relResources As New Data.DataRelation("Application_Resources", ..Tables("User_Applications").Columns("Application_id"),...
0
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
4
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
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...
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...
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
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,...
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
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,...
0
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...

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.