all groups > dotnet xml > july 2004 >
You're in the

dotnet xml

group:

XML Attributes in a DataSet


XML Attributes in a DataSet Ryan
7/27/2004 9:55:14 PM
dotnet xml:
How can one extract the Attribute values from a Dataset that has been loaded
with an XML file like the following at the bottom of the document. I have
to use a dataset and the XML file must remain the same?

Regards,
Ryan

<?xml version="1.0" encoding="utf-8" ?>
<Groups>
<Group Name="Information Technology" ID="IT" Description="Information
Technology" />
<Group Name="Finance" ID="Fin" Description="Finance Group"></Group>
<Group Name="Hyperion" ID="Hyp" Description="Individuals requiring access
to Hyperion."></Group>
<Group Name="Legal" ID="Leg" Description="Legal"></Group>
</Groups>

Re: XML Attributes in a DataSet Dino Chiesa [Microsoft]
7/29/2004 6:08:06 PM
If you have loaded the dataset with the XML, You can bind it to a datagrid
to display it, or you can programmatically examine it like this:

System.Data.DataTable dt = ds1.Tables["Group"];
int numRows = dt.Rows.Count;
int numCols = dt.Columns.Count;
for (int i=0; i < numRows; i++) {
for (int j=0; j < numCols; j++)
Console.Write("{0} ", dt.Rows[i][j]);
Console.WriteLine();
}

-D


[quoted text, click to view]

AddThis Social Bookmark Button