Compartilhar via


selectSingleNode Method

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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

Script Syntax

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

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 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 method.
  • 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 resultNode is 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 selectSingleNode method 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.

See Also

Concepts

selectNodes Method