Sets an attribute for the specified node.

Syntax

XML_Attribute *XML_SetAttribute(
  XML_HANDLE hXml,
  XML_Node *node,
  const char *name,
  const char *value,
  int *ErrCode
);

Parameters

hXml
[in] XML handle
node
[in] A pointer to the XML_Node structure of the node.
name
[in] A pointer to a string of the name for the attribute.
value
[in] A pointer to a string of the value for the attribute.
ErrCode
[out] A pointer to a variable that returns an error code. Specify NULL when no error code is required.

Return value

If the attribute setting is successful, it returns a pointer to the XML_Attribute structure of the attribute, otherwise NULL.

Remarks

Sets the attribute specified by name and value to the specified node and returns a pointer to the XML_Attribute structure of the attribute.

If the attribute with the name specified by name already exists, it will be overwritten with the new value.

If the attribute with the name specified by name does not exist, a new attribute will be added.

If the function fails, it returns NULL and ErrCode returns the following error code:

Error codeDescription
XML_INVALID_PARAMETER_ERRORParameter error
XML_MEMORY_ALLOCATION_ERRORMemory allocation error
XML_INVALID_XML_OBJECT_ERRORInvalid XML handle
XML_INVALID_NODE_OBJECT_ERRORInvalid node is specified.
XML_UNICODE_CONVERSION_ERRORLocal code characters that cannot be converted to Unicode have been detected.

Requirements

Header file:
XML.h
CodeConversion.h : ver. 1.1.1 or later.
Library file:
libXML.a
libCodeConversion.a : ver.1.1.1 or later
libSTARTUPOPH5000.a

See also

Last updated: 2021/10/21