xmlRemoveNode()

Removes the given node from its parent node.

Synopsis

int xmlRemoveNode(unsigned doc, int node);

Parameters

Parameter Description
doc The document ID returned by e.g. xmlNewDocument().
node Node ID

Return value

0 if the removing process was successful.

If an error occurs, -1 will be returned.

Description

Removes the given node from its parent node.

Example

This example creates a new document in memory and adds nodes to the document as well as deletes a node. It also sets an attribute and prints the content of the document.

#uses "CtrlXml"
main()
{
  int docNum = xmlNewDocument();
  xmlAppendChild(docNum, -1, XML_COMMENT_NODE, "my fine new
  comment");
  int node = xmlAppendChild(docNum, -1, XML_ELEMENT_NODE, "first
  element");
  node = xmlAppendChild(docNum, node, XML_ELEMENT_NODE,
  "sub_element");
  xmlSetElementAttribute(docNum, node, "anAttribute", "a
  value");
  node = xmlAppendChild(docNum, node, XML_TEXT_NODE, "some
  text");
  xmlSetNodeValue(docNum, node, "The new value");
  DebugN(xmlDocumentToString(docNum));
  xmlRemoveNode(docNum, node);
  DebugN(xmlDocumentToString(docNum));
}

Assignment

XML Control Extension

Availability

CTRL. In every script where the "CtrlXml" extension (#uses "CtrlXml") is used.