/* The node is not changed if it (or its first child) is not a CDATA element node. */
int mxmlSetCDATA(mxml_node_t *node, const char *data)
/* The node is not changed if it (or its first child) is not a CDATA element node. */
int mxmlSetCDATA(mxml_node_t *node, const char *data)
{
  if (node && node->type == MXML_ELEMENT &&
      strncmp(node->value.element.name, "![CDATA[", 8) &&
      node->child && node->child->type == MXML_ELEMENT &&
      !strncmp(node->child->value.element.name, "![CDATA[", 8))
    node = node->child;
  if (!node || node->type != MXML_ELEMENT || !data ||
      strncmp(node->value.element.name, "![CDATA[", 8))
    return (-1);
  if (node->value.element.name)
    free(node->value.element.name);
  node->value.element.name = _mxml_strdupf("![CDATA[%s]]", data);
  return (0);
}