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. XML / XSL
  4. XML Text access

XML Text access

Scheduled Pinned Locked Moved XML / XSL
xmlquestion
5 Posts 3 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
    Steve Severance
    wrote on last edited by
    #1

    I need to access the value of a node that also contains childnodes such as <node> text <child>value</child> </node> Inner text doesn't work because I get the child text also. I think that the way Innertext is done is pretty bad. Any Ideas? Thanks. Steve Steve Not all who wander are lost...

    R 1 Reply Last reply
    0
    • S Steve Severance

      I need to access the value of a node that also contains childnodes such as <node> text <child>value</child> </node> Inner text doesn't work because I get the child text also. I think that the way Innertext is done is pretty bad. Any Ideas? Thanks. Steve Steve Not all who wander are lost...

      R Offline
      R Offline
      Retsof Nawor
      wrote on last edited by
      #2

      You can just iterate through the children (IXMLDOMNodeList) checking the type (IXMLDOMNode::nodeType), if it is a text node (NODE_TEXT) append the value to your string otherwise keep iterating...

      S 1 Reply Last reply
      0
      • R Retsof Nawor

        You can just iterate through the children (IXMLDOMNodeList) checking the type (IXMLDOMNode::nodeType), if it is a text node (NODE_TEXT) append the value to your string otherwise keep iterating...

        S Offline
        S Offline
        Steve Severance
        wrote on last edited by
        #3

        Thanks. Will this also work on .NET? Steve Not all who wander are lost...

        R T 2 Replies Last reply
        0
        • S Steve Severance

          Thanks. Will this also work on .NET? Steve Not all who wander are lost...

          R Offline
          R Offline
          Retsof Nawor
          wrote on last edited by
          #4

          Sure, it'll work with any DOM/Language, just the interface/method/constants names may vary slightly...

          1 Reply Last reply
          0
          • S Steve Severance

            Thanks. Will this also work on .NET? Steve Not all who wander are lost...

            T Offline
            T Offline
            Tom Archer
            wrote on last edited by
            #5

            If you're using the .NET XML classes, then use XmlNode::ReadElementString. Cheers, Tom Archer Inside C#,
            Extending MFC Applications with the .NET Framework It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson

            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