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
Solved

Selecting multiple nodes using the selectNodes method.

Posted on 2001-06-15
6
202 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Title # Comments Views Activity
Change to event 1 117
.net and XML report from SCCM 5 41
tutorial for ebay api 3 55
TSQL XML Namespaces 7 22
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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