PROPERTY:  Object::previousSibling

Object  Attr   CDATASection   CharacterData   Comment   Document   DocumentFragment   DocumentType   Entity   EntityReference   Node   Notation   ProcessingInstruction   Text

The previousSibling property returns previous node in the parent's child list, or null if there is none or the node is of a type that cannot be a child node (Attr, Document, DocumentFragment).

The example that follows uses the 'passeriformes.xml' file which details the bird families belonging to that order. It first gets the lastChild node of the root, and then uses the previousSibling property to print the text of the node that precedes it.

      <species>Shore Lark</species>
      <species>Rock Pipit</species>
      <species>Water Pipit</species>
      <species>Yellow Wagtail</species>

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False

Dim lastChild, prevChild
Set lastChild = objXMLDoc.documentElement.lastChild
Set prevChild = lastChild.previousSibling

Motacillidae Rock Pipit Water Pipit Yellow Wagtail

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information