|
-
April 29th, 2011, 02:46 AM
#1
Help with extracting info from an XElement
I have stored procedure created by a client that returns an XElement object. Below is the sample of the XElement object:
<Rows>
<row>
<Header SchoolNumber="0111" SchoolName="Technical Institute" Address1="123 Main Street" City="Washington" State="DC" Zip="10008" DirectorsName="Mr. John Smith"/>
</row>
<row>
<Detail DateTakenActual="2010-01-28T00:00:00" ID="11111" GradYear="2009" ExamineeSt="DC" OverallStatus="Fail" IStatus="Pass" RStatus="Fail" GStatus="Pass" IScore="461" RScore="384" GScore="410"/>
</row>
</Rows>
How do I go about parsing this and extracting the data (SchoolNumber, SchoolName, DateTakenActual, etc). Thank you so much in advance!
-
May 1st, 2011, 02:56 PM
#2
Re: Help with extracting info from an XElement
Load your xml into an XmlDocument and the use an xpath query to extract it.
Read about xpath here: http://www.w3schools.com/xpath/default.asp
Read about XmlDocument here
http://www.csharpfriends.com/Article...?articleID=312
You don't have to load the xml from a file into the XmlDocument, you can just supply the string if you use the right method on the document.
-
May 3rd, 2011, 01:26 AM
#3
Re: Help with extracting info from an XElement
check with dataset and gridview may be it will works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|