CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2011
    Posts
    1

    Smile 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!

  2. #2
    Join Date
    Mar 2011
    Location
    London
    Posts
    54

    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.

  3. #3
    Join Date
    May 2011
    Posts
    5

    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
  •  





Click Here to Expand Forum to Full Width

Featured