次の方法で共有


selectSingleNode Method (Compact 2013)

3/26/2014

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

Syntax

var objXMLDOMNode = oXMLDOMNode.selectSingleNode(queryString);
HRESULT selectSingleNode(
  BSTR queryString,
  IXMLDOMNode** resultNode
);

Parameters

Script

  • 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.

C/C++

  • 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.

Return Value

Script

Object. Returns the first node that matches the XSL or XPath query. If no nodes match the query, it returns Null.

C/C++

  • S_OK
    Value returned if successful.
  • S_FALSE
    Value returned if there is no match.
  • E_INVALIDARG
    Value returned if resultNode is Null.

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.

Requirements

Header

msxml2.h,
msxml2.idl

Library

uuid.lib

See Also

Reference

XML DOM Methods
selectNodes Method