Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

XML SelectSingleNode

Posted on 2009-04-15
3
Medium Priority
?
686 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 100 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 100 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

610 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