Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Applies the specified pattern-matching operation to this node's context and returns the first matching node.
Script Syntax
Copy Code | |
---|---|
var objXMLDOMNode = oXMLDOMNode.selectSingleNode( queryString); |
Remarks
Script Parameters
- queryString
-
String specifying the Extensible Stylesheet Language (XSL) or XPath query that is to be applied to the context defined by this node. The value of the SelectionLanguage internal property (flag) determines whether an XSL or XPath query is used. By default, the expression is an XSL pattern query. The SelectionLanguage internal property (flag) can be set with the setProperty methodxmmthsetProperty.
Script Return Value
Object. Returns the first node that matches the XSL or XPath query. If no nodes match the query, it returns Null.
C/C++ Syntax
C++ | Copy Code |
---|---|
HRESULT selectSingleNode( BSTR queryString, IXMLDOMNode** resultNode ); |
Remarks
C/C++ Parameters
- queryString
-
[in] String specifying the XSL or XPath query that is to be applied to the context defined by this node. The value of the SelectionLanguageinternal property (flag) determines whether an XSL or XPath query is used. By default, the expression is an XSL pattern query. The SelectionLanguageinternal property (flag) can be set with the setPropertymethod.
- resultNode
-
[out, retval] First node that is selected by the XPath query. If no nodes result from the query, it returns Null.
C/C++ Return Values
- S_OK
-
Value returned if successful.
- S_FALSE
-
Value returned if there is no match.
- E_INVALIDARG
-
Value returned if resultNodeis Null.
Requirements
Header | msxml2.h, msxml2.idl |
Library | uuid.lib |
Windows Embedded CE | Windows CE .NET 4.0 and later |
General Remarks
This method is only valid if the XML Query Language (XQL) feature has been included in the OS. If a call to this method is made and XQL is not supported, an error message will be returned.
The selectSingleNodemethod is similar to 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 World Wide Web Consortium (W3C) Document Object Model (DOM).
This method applies to the following objects and interfaces:
IXMLDOMAttribute, IXMLDOMCDATASection, IXMLDOMCharacterData, IXMLDOMComment, DOMDocument, IXMLDOMDocumentFragment, IXMLDOMDocumentType, IXMLDOMElement, IXMLDOMEntity, IXMLDOMEntityReference, IXMLDOMNode, IXMLDOMNotation, IXMLDOMProcessingInstruction, IXMLDOMText, and IXTLRuntime.