Adds a child node to the specified node.

Syntax

XML_Node *XML_AddChildNode(
  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 that specifies the name of the child node to add.
value
[in] A pointer to a string that specifies the value of the child node to add. Specify NULL to add an empty node that has no value.
ErrCode
[out] A pointer to a variable that returns an error code. Specify NULL when no error code is required.

Return value

If the function succeeds, it returns a pointer to the XML_Node structure of the added node, otherwise NULL.  

Remarks

Adds a child node with the specified name and value to the specified node and returns a pointer to the XML_Node structure of the added node.

A child node cannot be added if the specified node has a value. In this case, the function will fail and return XML_CHILD_NODE_DISALLOWED_ERROR in ErrCode.

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.
XML_CHILD_NODE_DISALLOWED_ERRORThe child node could not be added because the node has a value.

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