Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

XMLSetAttribute

  • Last UpdatedJul 18, 2023
  • 1 minute read

Use this function to set the value of specified attribute of the node in the XML document. If the attribute does not exist, it will be created.

Syntax

INT XMLSetAttribute(INT hDoc, INT hNode, STRING sName, STRING sValue)

hDoc

Handle of the XML document. Returned by XMLCreate or XMLOpen.

hNode

Handle of the node. Returned by XMLGetRoot, XMLGetChild, XMLGetParent or XMLNodeFind.

sName

The name of the attribute.

sValue

The value of the attribute

Return Value

0 (zero) if successful, otherwise an error code is returned.

XMLClose, XMLCreate, XMLGetAttribute, XMLGetAttributeCount, XMLGetAttributeName, XMLGetAttributeValue, XMLGetChild, XMLGetChildCount, XMLGetParent, XMLGetRoot, XMLNodeAddChild, XMLNodeFind, XMLNodeGetName, XMLNodeGetValue, XMLNodeRemove, XMLNodeSetValue, XMLOpen, XMLSave

Example

Following example creates an XML document from local file "H:\Data\books.xml", then selects the first node that matches XPath expression "/bookstore/book/" and sets the value of the node’s attribute "Language" to "English".

INT hDoc, hNode;

hDoc = XMLOpen("H:\Data\books.xml");

IF hDoc less -1 THEN

hNode = XMLNodeFind(hDoc,"/bookstore/book/");

IF hNode less -1 THEN

XMLSetAttribute(hDoc, hNode, "Language", "English");

END

END

See Also

XML Functions

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in