Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6044929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:04:05+00:00 2026-05-23T07:04:05+00:00

I have a whole XML document in a String which i need to convert

  • 0

I have a whole XML document in a String which i need to convert to a XML document and parse tags in the document

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:04:05+00:00Added an answer on May 23, 2026 at 7:04 am

    This code sample is taken from csharp-examples.net, written by Jan Slama:

    To find nodes in an XML file you can use XPath expressions. Method XmlNode.Selec­tNodes returns a list of nodes selected by the XPath string. Method XmlNode.Selec­tSingleNode finds the first node that matches the XPath string.

    XML:

    <Names>
        <Name>
            <FirstName>John</FirstName>
            <LastName>Smith</LastName>
        </Name>
        <Name>
            <FirstName>James</FirstName>
            <LastName>White</LastName>
        </Name>
    </Names>
    

    CODE:

    XmlDocument xml = new XmlDocument();
    xml.LoadXml(myXmlString); // suppose that myXmlString contains "<Names>...</Names>"
    
    XmlNodeList xnList = xml.SelectNodes("/Names/Name");
    foreach (XmlNode xn in xnList)
    {
      string firstName = xn["FirstName"].InnerText;
      string lastName = xn["LastName"].InnerText;
      Console.WriteLine("Name: {0} {1}", firstName, lastName);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a style applied to my whole application: AndroidManifest.xml: <application android:theme=@style/ApplicationStyle android:icon=@drawable/icon android:label=@string/app_name>
I have an xml file where I need to comment out a whole piece
I have got the XML below, which is stored in string type variable, and
I have this code. class MyParser < Nokogiri::XML::SAX::Document def characters(string) LOG.debug(characters #{string}) end def
I have XML document that I parse with jDOM and then try to take
I have this xml feed in Chinese, which NSXLParsers is unable to parse. It
I wanted to convert a string (which obviously is an xml) to an XmlNode
How can I have a text file (or XML file) represented as a whole
My input is a InputStream which contains an XML document. Encoding used in XML
I have an application which serializes and deserializes .NET objects to XML. While deserializing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.