xmlNextSibling()

Returns an internal ID for the next sibling of the given node.

Synopsis

int xmlNextSibling(unsigned doc, unsigned node);

Parameters

Parameter Description
doc The document ID returned by e.g. xmlNewDocument().
node Node for whose next sibling the internal ID should be returned.

Return value

Internal ID for the next sibling.

It returns -1 if there is no such node.

Description

Returns an internal ID for the next sibling of the given node.

Example

Reads the d:/XmlTest0.xml file and creates a document. The content of the document is printed using printNodes. The function xmlElementAttributes returns all node attributes as a mapping. XmlNextSibling is used to return the internal Id of the next sibling of a node.

#uses "CtrlXml"
global uint docNum;
global string err;
global int errLine, errColumn;
main()
{
  uint node;
  DebugN(docNum = xmlDocumentFromFile("d:/XmlTest0.xml", err,
  errLine,
  errColumn));
  DebugN("error:", err, errLine, errColumn);
  printNodes(node = xmlFirstChild(docNum));
  xmlSetElementAttribute(docNum, node, "test_attribute", "some
  fancy value !!");
}
void printNodes(int node)
{
  if ( node != -1 )
  {
    if ( xmlNodeType(docNum, node) == XML_TEXT_NODE )
    DebugN("value:", xmlNodeValue(docNum, node));
    if ( xmlNodeType(docNum, node) == XML_ELEMENT_NODE )
    DebugN(xmlNodeName(docNum, node), xmlElementAttributes(docNum,
    node) );
    printNodes(xmlFirstChild(docNum, node));
    printNodes(xmlNextSibling(docNum, node));
    DebugN(xmlDocumentFromFile(docNum, "d:/XmlTest0.xml",err,
    errLine,
    errColumn));
  }
}

Assignment

XML Control Extension

Availability

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