Compartilhar via


getAttribute Method (Compact 2013)

3/26/2014

Retrieves the value of the attribute.

Syntax

objValue = oXMLDOMElement.getAttribute(name);
HRESULT getAttribute(BSTR name, VARIANT* value);

Parameters

Script

  • name
    String specifying the name of the attribute to return.

C/C++

  • name
    [in] Name of the attribute to return.
  • value
    [out, retval] String that contains the attribute value. The empty string is returned if the named attribute does not have a specified or default value.

Return Value

Script

Variant. Returns a string that contains the attribute value or returns the empty string if the named attribute does not have a specified or default value.

C/C++

  • S_OK
    Value returned if successful.
  • S_FALSE
    Value when no attribute with the given name is found.
  • E_INVALIDARG
    Value returned if name is Null.

Remarks

You can also retrieve attributes by using the getNamedItem Method of the IXMLDOMNamedNodeMap.

This method applies to the following objects and interfaces:

IXMLDOMElement and IXMLDOMNamedNodeMap.

Requirements

Header

msxml2.h,
msxml2.idl

Library

uuid.lib

See Also

Reference

XML DOM Methods
getNamedItem Method