SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    Denver
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to get the value of xml elment

    Greetings, I have an xml document loaded into var oxmlDom, how do I go about getting the value inside a single element.
    Example:

    <catalog>
    <cd>Looking for this value</cd>
    <cd>Looking for this value</cd>
    </catalog>

    Code:
    oXmlDom.documentElement.selectSingleNode('XPath/To/My/Node');
    oXmlDom.documentElement.selectSingleNode('XPath/To/My/Node').xml is getting me <cd>Looking for this value</cd>

    I'm also trying to do
    oXmlDom.documentElement.selectSingleNode('XPath/To/My/Node').nodeValue
    but I'm getting null. Thanks.

  2. #2
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    Denver
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just found what I was looking for.
    oXmlDom.documentElement.selectSingleNode('XPath/To/My/Node').text

    did the trick.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •