다음을 통해 공유


setAttribute Method (Windows Embedded CE 6.0)

1/6/2010

Sets the value of the named attribute.

Script Syntax

oXMLDOMElement.setAttribute(name, value);

Remarks

Ee503427.collapse(en-US,WinEmbedded.60).gifScript Parameters

  • name
    String specifying the name of the attribute. If the attribute with that name already exists, its value is changed. If the attribute with that name does not exist, it is created.
  • value
    Variant that supplies the value for the named attribute.

Ee503427.collapse(en-US,WinEmbedded.60).gifScript Return Value

None.

Ee503427.collapse(en-US,WinEmbedded.60).gifC/C++ Syntax

HRESULT setAttribute(
  BSTR  name,
  VARIANT  value
);

Remarks

Ee503427.collapse(en-US,WinEmbedded.60).gifC/C++ Parameters

  • name
    [in] Name of the attribute. If an attribute with that name already exists, its value is changed. If an attribute with that name does not exist, it is created.
  • value
    [in] Value for the named attribute.

Ee503427.collapse(en-US,WinEmbedded.60).gifC/C++ Return Values

  • S_OK
    Value returned if successful.
  • E_FAIL
    Value returned if an error occurs.

Ee503427.collapse(en-US,WinEmbedded.60).gifRequirements

Header msxml2.h, msxml2.idl
Library uuid.lib
Windows Embedded CE Windows CE .NET 4.0 and later

General Remarks

If an attribute with the supplied name already exists, this method changes its value to the supplied value parameter. The supplied string is not parsed, so any markup, such as syntax meant to be recognized as an entity reference, is treated as literal text and must be appropriately escaped by the implementation when it is written out.

To assign an attribute value that contains entity references, the user must create IXMLDOMAttribute plus any IXMLDOMText and IXMLDOMEntityReference objects, build the appropriate subtree, and call the setAttributeNode Method.

This method applies to the following objects and interfaces:

IXMLDOMAttribute, IXMLDOMElement, IXMLDOMText, and IXMLDOMEntityReference.

See Also

Reference

XML DOM Methods

Other Resources