HasChildren

Description

Indicates whether a PBDOM_ELEMENT object has one or more child objects.

Syntax

pbdom_element_name.HasChildren()

Argument

Description

pbdom_element_name

The name of a PBDOM_ELEMENT object


Return value

Boolean.

Returns true if this PBDOM_ELEMENT object has at least one child object and false if this PBDOM_ELEMENT object has no child objects.

Examples

The HasChildren method is invoked for elements in the following XML fragment:

<books>
     <title>Inside OLE</title>
     <author>Kraig Brockschmidt</author>
     <site href="http://www.microsoft.com/press"/>
</books>

The books element has three child elements: title, author, and site. The title and author elements each have a child PBDOM_TEXT object. The HasChildren method returns a value of true when invoked for these elements.

In contrast, the site element has a PBDOM_ATTRIBUTE href, which is not considered a child PBDOM_OBJECT. The HasChildren method returns a value of False when invoked for the site element.

Usage

PBDOM's implementation of the HasChildren method differs from JDOM's implementation in that the JDOM HasChildren method returns true only if an Element contains child Elements. Text and other types of objects do not count.

PBDOM provides an alternative method, HasChildElements, to specifically detect whether a PBDOM_ELEMENT object has at least one child PBDOM_ELEMENT object.

See also

HasChildElements

IsRootElement