Solved

XML SelectSingleNode

Posted on 2009-04-15
3
677 Views
Last Modified: 2013-11-18
I am trying to extract all child nodes in an XML document with a certain name, using the SOAP toolkit.
At the moment I cannot extract anything further down than the root, I need to find nodes in the body of the XML.
My XML document uses a bespoke namespace, so I am using this syntax:
Set objNode = oRoot.selectSingleNode("testNS:Results")
Where Results is the root node. This works and I get a node back.

But I am looking 5 levels down into the XML for what I really want.
When I try this (retrieve a node below the root ):

Set objNode = oRoot.selectSingleNode("testNS:Results/Level2")

I get nothing.

What am I doing wrong?
0
Comment
Question by:BrianGilbert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
dan_neal earned 25 total points
ID: 24147079
If you want to return all nodes of with a certain name you should use SelectNodes(xpath).  SelectSingleNode give you just the one node and its children instead of all nodes of that name and their children.
0
 
LVL 60

Assisted Solution

by:Geert Bormans
Geert Bormans earned 25 total points
ID: 24147618
dan_neal has a point about using selectNodes to get the entire set,
but there is more, you need to change the XPath too,
now your XPath only looks at the top level
In order for XPath to dig deeper in the tree, you will need a "//" denoting that you need that patteren anywhere in the tree

Set objNodes = oRoot.selectNodes("//Level2")
make sure you have the namespace right
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question