Microsoft XML SDK 2.6 - XML Reference

firstChild Property

Contains the first child of this node.

objXMLDOMNode = oXMLDOMNode.firstChild

Remarks

Object. The property is read-only. Returns the first child node. If there are no such children, 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 first 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 sets currNode to the first child node of the top-level node:

Dim xmlDoc
Dim currNode
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set currNode = xmlDoc.documentElement.firstChild
MsgBox currNode.xml

See Also

Applies To: XMLDOMAttribute Object | XMLDOMCDATASection Object | XMLDOMCharacterData Object | XMLDOMComment Object | DOMDocument Object | XMLDOMDocumentFragment Object | XMLDOMDocumentType Object | XMLDOMElement Object | XMLDOMEntity Object | XMLDOMEntityReference Object | XMLDOMNode Object | XMLDOMNotation Object | XMLDOMProcessingInstruction Object | XMLDOMText Object | XTLRuntime Object