Solved

Selecting multiple nodes using the selectNodes method.

Posted on 2001-06-15
6
198 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
Comment Utility
try this :

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

Accepted Solution

by:
rdov earned 50 total points
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 23

Expert Comment

by:b1xml2
Comment Utility
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
Comment Utility
<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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

10 Experts available now in Live!

Get 1:1 Help Now