/* The node is not changed if it (or its first child) is not a text node.  */
int mxmlSetTextf(mxml_node_t *node, int whitespace, const char *format,...)
/* The node is not changed if it (or its first child) is not a text node.  */
int mxmlSetTextf(mxml_node_t *node, int whitespace, const char *format,...)
{
  va_list	ap;
  if (node && node->type == MXML_ELEMENT &&
      node->child && node->child->type == MXML_TEXT)
    node = node->child;
  if (!node || node->type != MXML_TEXT || !format)
    return (-1);
  if (node->value.text.string)
    free(node->value.text.string);
  va_start(ap, format);
  node->value.text.whitespace = whitespace;
  node->value.text.string     = _mxml_strdupf(format, ap);
  va_end(ap);
  return (0);
}