Click to return to the XML (Extensible Markup Language) home page    
XMLDOMNode selectNodes Me...     XMLDOMNode specified Prop...     XMLDOMNode Object    
Web Workshop  |  XML (Extensible Markup Language)

selectSingleNode Method


Applies the specified pattern-matching operation to this node's context and returns the first matching node.

Syntax

objXMLDOMNode = oXMLDOMNode.selectSingleNode(patternString)

Parameters

patternString
String specifying the XSL Pattern query that is to be applied to the context defined by this node.

Returns

Object. Returns the first node that matches the XSL Pattern query. If no nodes match the query, it returns NULL.

Remarks

For a complete description, see the XSL Pattern Syntax reference.

The selectSingleNode method is much like the selectNodes method, but returns only the first matching node rather than the list of all matching nodes.

This member is an extension of the W3C DOM.

Example

The following example creates an XMLDOMNode object and sets it to the first instance of an "Author" node with a "Book" parent, then displays the text of the node:

Dim xmlDoc
Dim currNode

Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set currNode = xmlDoc.documentElement.selectSingleNode("BOOK/AUTHOR")
MsgBox currNode.text

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
XMLDOMAttribute, XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMDocument, XMLDOMDocumentFragment, XMLDOMDocumentType, XMLDOMElement, XMLDOMEntity, XMLDOMEntityReference, XMLDOMNode, XMLDOMNotation, XMLDOMProcessingInstruction, XMLDOMText, XTLRuntime

See Also

Using the XSL Processor



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.