nextSibling Property
Contains the next sibling of the node in the parent's child list.
[Script]
Script Syntax
var objXMLDOMNode = oXMLDOMNode.nextSibling;
Example
The following script example creates an IXMLDOMNode object and sets it to the next sibling of the current node.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
var currNode;
var nextNode;
xmlDoc.async = false;
xmlDoc.load("books.xml");
currNode = xmlDoc.documentElement.childNodes.item(0);
nextNode = currNode.nextSibling;
alert(nextNode.xml);
[Visual Basic]
Visual Basic Syntax
Set objXMLDOMNode = oXMLDOMNode.nextSibling
Example
The following Microsoft® Visual Basic® example creates an IXMLDOMNode object and sets it to the next sibling of the current node.
Dim xmlDoc As New Msxml2.DOMDocument40
Dim currNode As IXMLDOMNode
Dim nextNode As IXMLDOMNode
xmlDoc.async = False
xmlDoc.Load ("books.xml")
Set currNode = xmlDoc.documentElement.childNodes.Item(0)
Set nextNode = currNode.nextSibling
MsgBox nextNode.xml
[C/C++]
C/C++ Syntax
HRESULT get_nextSibling(
IXMLDOMNode **nextSibling);
Parameters
- nextSibling [out, retval]
- Right sibling of this node.
C/C++ Return Values
- S_OK
- Value returned if successful.
- S_FALSE
- Value returned when there is no next sibling.
- E_INVALIDARG
- Value returned if nextSibling is Null.
Remarks
The property is read-only. It returns the right sibling of this node.
This value depends on the value of the nodeType property.
| NODE_ATTRIBUTE, NODE_DOCUMENT, NODE_DOCUMENT_FRAGMENT |
Always returns Null; these node types do not appear as children of any other nodes. |
| NODE_CDATA_SECTION, NODE_COMMENT, NODE_DOCUMENT_TYPE, NODE_ELEMENT, NODE_ENTITY, NODE_ENTITY_REFERENCE, NODE_NOTATION, NODE_PROCESSING_INSTRUCTION, NODE_TEXT |
Returns the node immediately following this node in the list of children of this node's parent. If no such node exists, returns Null. |
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button
in the upper-left corner of the page.
See Also
nodeType Property
Applies to: IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText