Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the last child node.
Script Syntax
var objXMLDOMNode = oXMLDOMNode.lastChild;
Example
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.3.0");
var root;
var newNode;
var currNode;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
var myErr = xmlDoc.parseError;
WScript.Echo("You have error " + myErr.reason);
} else {
var root = xmlDoc.documentElement;
WScript.Echo(root.xml);
var newNode = xmlDoc.createNode(1, "VIDEOS", "");
currNode = root.insertBefore(newNode, root.lastChild);
WScript.Echo(root.xml);
}
Visual Basic Syntax
Set objXMLDOMNode = oXMLDOMNode.lastChild
C/C++ Syntax
HRESULT get_lastChild(
IXMLDOMNode **lastChild);
Parameters
lastChild
[out, retval]
The last child node. If there are no children, it returns Null.
C/C++ Return Values
S_OK
The value returned if successful.
S_FALSE
The value returned when there are no children.
E_INVALIDARG
The value returned if the lastChild
parameter is Null.
Remarks
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. |
Versioning
Implemented in:
MSXML 3.0, MSXML 6.0
Applies to
IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMDocument-DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText