Contains the previous sibling of the node in the parent's child list.
var objXMLDOMNode = oXMLDOMNode.previousSibling;
The following script example creates an IXMLDOMNode
object and sets it to the previous sibling of the current node.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); var currNode; var prevNode; xmlDoc.async = false; xmlDoc.load("books.xml"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError; alert("You have error " + myErr.reason); } else { currNode = xmlDoc.documentElement.childNodes.item(1); prevNode = currNode.previousSibling; alert(prevNode.xml); }
Set objXMLDOMNode = oXMLDOMNode.previousSibling
The following Microsoft® Visual Basic® example creates an IXMLDOMNode
object and sets it to the previous sibling of the current node.
Dim xmlDoc As New Msxml2.DOMDocument50 Dim currNode As IXMLDOMNode Dim prevNode As IXMLDOMNode xmlDoc.async = False xmlDoc.Load ("books.xml") If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else Set currNode = xmlDoc.documentElement.childNodes.Item(1) Set prevNode = currNode.previousSibling MsgBox prevNode.xml End If
HRESULT get_previousSibling( IXMLDOMNode **previousSibling);
previousSibling
parameter is Null.The property is read-only.
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 preceding this node in its parent's child list. Returns Null if no such node exists. |
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.
Applies to: IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText