Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Reading values from xml string

Reading values from xml string

Scheduled Pinned Locked Moved C#
questioncsharpxmljsonhelp
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sarang_k
    wrote on last edited by
    #1

    Hi all, In my c# application by using one predefined function i am getting the whole xml file in a string. And i am having one class file which is used for serialization. But now the problem is the string in which i am getting whole xml file from that i want to read the value of a node and assign it to one of the member of the class file. How can i do it ? Thanks in advance.

    A V 2 Replies Last reply
    0
    • S sarang_k

      Hi all, In my c# application by using one predefined function i am getting the whole xml file in a string. And i am having one class file which is used for serialization. But now the problem is the string in which i am getting whole xml file from that i want to read the value of a node and assign it to one of the member of the class file. How can i do it ? Thanks in advance.

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      You can use XElement to read nodes within an xml file. Here[^] is a nice and easy example on how you could do this.

      B 1 Reply Last reply
      0
      • A Abhinav S

        You can use XElement to read nodes within an xml file. Here[^] is a nice and easy example on how you could do this.

        B Offline
        B Offline
        BobJanova
        wrote on last edited by
        #3

        Countered the 1 vote on this since it seems to be a good answer.

        A 1 Reply Last reply
        0
        • B BobJanova

          Countered the 1 vote on this since it seems to be a good answer.

          A Offline
          A Offline
          Abhinav S
          wrote on last edited by
          #4

          Thanks.

          1 Reply Last reply
          0
          • S sarang_k

            Hi all, In my c# application by using one predefined function i am getting the whole xml file in a string. And i am having one class file which is used for serialization. But now the problem is the string in which i am getting whole xml file from that i want to read the value of a node and assign it to one of the member of the class file. How can i do it ? Thanks in advance.

            V Offline
            V Offline
            V 0
            wrote on last edited by
            #5

            You can use LINQ to XML which is probably the easiest and most performant way of doing it. (And it is this way that uses the XElement class mentioned earlier. They're are good tutorials on LINQ here at CP or on google.

            V.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups