Solved

Selecting multiple nodes using the selectNodes method.

Posted on 2001-06-15
6
199 Views
Last Modified: 2008-02-26
Hi all

I need to select all <input> and <select> nodes using XML.selectNodes

I can retrieve a nodelist set using
oXML.selectNodes("//input")

How do I specify "and //select" to include all the <select> elements in the nodelist?

S
0
Comment
Question by:Skin
6 Comments
 
LVL 3

Expert Comment

by:dragosh
ID: 6194800
try this :

selectNodes("//(input|select)")
0
 
LVL 4

Accepted Solution

by:
rdov earned 50 total points
ID: 6201309
Since the expression can use either the XPath 1.0 or XSL Patterns syntax, there needs to be a way to specify the selection language before using these APIs. To maintain backwards compatibility with existing code, the default selection language is XSL Patterns. To change the current selection language to XPath, call the new setProperty method (see IXMLDOMDocument2) using the SelectionLanguage property name and the value XPath:
node.ownerDocument.setProperty "SelectionLanguage", "XPath"
applyExpression node, "/child::foo/descendant::bar/baz"
To set the selection language back to XSL Patterns, simply call setProperty again using the value XSLPattern.

for more information:
http://msdn.microsoft.com/library/periodic/period00/xml0900.htm 

HowTo: Use XPath Queries in MSXML DOM selectNodes Method:
http://support.microsoft.com/support/kb/articles/Q288/9/13.ASP

Extensible Stylesheet Language (XSL):
http://www.w3.org/TR/1998/WD-xsl-19981216.html

try also this link:
http://msdn.microsoft.com/xml/samples/index.asp
(for example:
http://msdn.microsoft.com/xml/samples/authors/author-patterns.htm)

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6790125
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.
____________________________________________
---------->  Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

------------->  The ALL TOPICS link has been updated today to reflect all the new TAs.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 23

Expert Comment

by:b1xml2
ID: 6941234
answer is:

applicable only to MSXML3+

JScript
========
oXML.setProperty("SelectionLanguage","XPath");
var oNodeList = oXML.selectNodes("//*[self::input or self::select]");


VBScript
==================
Dim oNodeList
oXML.setProperty "SelectionLanguage","XPath"
Set oNodeList = oXML.selectNodes("//*[self::input or self::select]")

VB
===
Dim oNodeList As IXMLDOMNodelist
oXML.setProperty "SelectionLanguage","XPath"
Set oNodeList = oXML.selectNodes("//*[self::input or self::select]")
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 6941236
<review>

<special>
Answer provided to add value to PAQ.
</special>

<recommendation>
split between rdov and b1xml2
</recommendation>

<objection>
any objection should be raised within 7 days
</objection>

<reviewer>
b1xml2
</reviewer>

</review>
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6948855
Per recommendation, force-accepted by
Netminder
CS Moderator

b1xml2: points for you at http://www.experts-exchange.com/jsp/qShow.jsp?ta=xml&qid=20290641
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now