Microsoft XML 2.5 SDK


 

lastChild Property

[This is preliminary documentation and subject to change.]

Returns the last child node.

Syntax

objXMLDOMNode = oXMLDOMNode.lastChild

Remarks

Object. 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.

Example

The following VBScript example creates a new XMLDOMNode (element) object, then inserts it before the last child of the top-level node:

Dim xmlDoc
Dim root
Dim newNode
Dim currNode
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set root = xmlDoc.documentElement
MsgBox root.xml
Set newNode = xmlDoc.createNode (1, "VIDEOS", "")
Set currNode = root.insertBefore(newNode, root.lastChild)
MsgBox root.xml

Applies To

XMLDOMAttribute, XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMDocument, XMLDOMDocumentFragment, XMLDOMDocumentType, XMLDOMElement, XMLDOMEntity, XMLDOMEntityReference, XMLDOMNode, XMLDOMNotation, XMLDOMProcessingInstruction, XMLDOMText, XTLRuntime