Click to return to the XML (Extensible Markup Language) home page    
XMLDOMNode definition Pro...     XMLDOMNode hasChildNodes ...     XMLDOMNode Object    
Web Workshop  |  XML (Extensible Markup Language)

firstChild Property


Contains the first child of this node.

Syntax

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 example sets currNode to the first child node of the top-level node:

Dim xmlDoc
Dim currNode

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

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
XMLDOMAttribute, XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMDocument, XMLDOMDocumentFragment, XMLDOMDocumentType, XMLDOMElement, XMLDOMEntity, XMLDOMEntityReference, XMLDOMNode, XMLDOMNotation, XMLDOMProcessingInstruction, XMLDOMText, XTLRuntime


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.