   
insertBefore()
Is a member of:
|
DOMDocument
XMLDOMNode
XMLDOMAttribute
XMLDOMCDATASection
XMLDOMComment
XMLDOMDocumentFragment
XMLDOMDocumentType
XMLDOMElement
XMLDOMEntity
XMLDOMEntityReference
XMLDOMNotation
XMLDOMProcessingInstruction
XMLDOMText
XTLRuntime
|
Syntax
set objXMLDOMNode = objXMLDOMNode.insertBefore(newChild, refChild)
Remark
This method inserts a new child Node before the current Node (objXMLDOMNode).
From the methods signature, if you do not include a parameter, refChild, then this function acts the same as the appendChild() method. Here the refChild must be a child Node of the current Node (objXMLDOMNode). This indicates that the new child must be inserted before this refChild Node (which is the left sibling).
The DOMDocument checks that the refChild is a child Node of the current Node (objXMLDOMNode). If it is not, then an error will occur.
This method returns the child that has been successfully inserted. The method will return an error if you have tried to do an impossible operation, such as adding a Node of type NODE_DOCUMENT_TYPE (which cannot be a child Node), or the refChild is not a child Node of the current Node. See the nodeType property and the createNode() method for more information on types of Nodes.    
This manuscript is an abridged version of a chapter
from the Manning
Publications book XML
Programming with VB and ASP. This chapter looks at the Microsoft DOM objects. NOTE: Most images have been removed to increase speed and many of the code comments have also been removed for presentation. Please purchase the book to enjoy the full experience of all the chapters with images and code comments!
|