Returns the last child node.
var objXMLDOMNode = oXMLDOMNode.lastChild;
The following script example creates a new IXMLDOMNode
(element) object, and then inserts it before the last child of the top-level node.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); var root; var newNode; var currNode; xmlDoc.async = false; xmlDoc.load("books.xml"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError; alert("You have error " + myErr.reason); } else { var root = xmlDoc.documentElement; alert(root.xml); var newNode = xmlDoc.createNode(1, "VIDEOS", ""); currNode = root.insertBefore(newNode, root.lastChild); alert(root.xml); }
Set objXMLDOMNode = oXMLDOMNode.lastChild
The following Microsoft® Visual Basic® example creates a new IXMLDOMNode
(element) object, and then inserts it before the last child of the top-level node.
Dim xmlDoc As New Msxml2.DOMDocument50 Dim root As IXMLDOMElement Dim newNode As IXMLDOMNode Dim currNode 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 root = xmlDoc.documentElement MsgBox root.xml Set newNode = xmlDoc.createNode(NODE_ELEMENT, "VIDEOS", "") Set currNode = root.insertBefore(newNode, root.lastChild) MsgBox root.xml End If
HRESULT get_lastChild( IXMLDOMNode **lastChild);
lastChild
parameter is Null.The property is read-only. If there are no children, it returns Null.
This value depends on the value of the nodeType
property.
NODE_ATTRIBUTE
NODE_DOCUMENT NODE_DOCUMENT_FRAGMENT NODE_DOCUMENT_TYPE NODE_ELEMENT NODE_ENTITY NODE_ENTITY_REFERENCE |
Returns the last child node. If there are no children, returns Null. |
NODE_CDATA_SECTION
NODE_COMMENT NODE_NOTATION NODE_PROCESSING_INSTRUCTION NODE_TEXT |
Returns Null. These node types cannot have children. |
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