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. Xml Reader - Read Entire Subtree

Xml Reader - Read Entire Subtree

Scheduled Pinned Locked Moved C#
helpxmltutorialquestion
3 Posts 2 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.
  • L Offline
    L Offline
    Lea Hayes
    wrote on last edited by
    #1

    Hi guys, I am working on a program which reads and writes XML for plugin objects. In some instances a plugin might not be available, for example if a document is loaded on a computer which does not have the plugin installed. So to remedee this situation I am writing a class which will store all of the origionally read XML and then later restore that XML to the document. Is there a simple way to read an entire XML subtree (of a particular XML element) into a string using an object of the XmlReader class? This would be fantastic because this would solve my problem instantly. From past work I seem to remember something about writing raw XML into a file, however I cannot find anything about reading an entire subtree as a string in MSDN. Any help would be fantastic! Best regards! Lea Hayes

    N 1 Reply Last reply
    0
    • L Lea Hayes

      Hi guys, I am working on a program which reads and writes XML for plugin objects. In some instances a plugin might not be available, for example if a document is loaded on a computer which does not have the plugin installed. So to remedee this situation I am writing a class which will store all of the origionally read XML and then later restore that XML to the document. Is there a simple way to read an entire XML subtree (of a particular XML element) into a string using an object of the XmlReader class? This would be fantastic because this would solve my problem instantly. From past work I seem to remember something about writing raw XML into a file, however I cannot find anything about reading an entire subtree as a string in MSDN. Any help would be fantastic! Best regards! Lea Hayes

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      lhayes00 wrote:

      Is there a simple way to read an entire XML subtree (of a particular XML element) into a string using an object of the XmlReader class?

      Why not go with XMLDocument class and use XPath to get the element and child elements. Look at the "innerXML" property to get a string representation of the entire element.

      L 1 Reply Last reply
      0
      • N N a v a n e e t h

        lhayes00 wrote:

        Is there a simple way to read an entire XML subtree (of a particular XML element) into a string using an object of the XmlReader class?

        Why not go with XMLDocument class and use XPath to get the element and child elements. Look at the "innerXML" property to get a string representation of the entire element.

        L Offline
        L Offline
        Lea Hayes
        wrote on last edited by
        #3

        Hi! That's exactly what I needed! :-D Thanks!! Lea Hayes

        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