Description
Determines whether this PBDOM_ATTRIBUTE object contains any child PBDOM_OBJECTs.
Syntax
pbdom_attribute_name.HasChildren()
Return value
Boolean.
Returns true if this PBDOM_ATTRIBUTE contains child objects and false otherwise.
Throws
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE -- This PBDOM_OBJECT object is not associated with a derived PBDOM_OBJECT class object.
Examples
This example creates a PBDOM_DOCUMENT from a string. The XML document in the string already contains a root element named root that contains an attribute attr that contains an empty string. It then represents attr as a PBDOM_ATTRIBUTE object and calls its HasChildren method, which returns true because a PBDOM_ATTRIBUTE always contains at least one child object. After a call to GetContent, the message box shows that attr contains only one child, a PBDOM_TEXT that represents the empty string:
PBDOM_BUILDER pbdom_buildr PBDOM_DOCUMENT pbdom_doc PBDOM_ATTRIBUTE pbdom_attr string strXML = "<root attr=~"~"></root>" try pbdom_buildr = Create PBDOM_BUILDER pbdom_doc = pbdom_buildr.BuildFromString(strXML) pbdom_attr = pbdom_doc.GetRootElement(). & GetAttribute("attr") if (pbdom_attr.HasChildren()) then PBDOM_OBJECT pbdom_obj_array[] long l = 0 pbdom_attr.GetContent(pbdom_obj_array) for l = 1 to UpperBound (pbdom_obj_array) MessageBox ("Attr Child Object", & pbdom_obj_array[l].GetObjectClassString()) next end if catch (pbdom_exception pbdom_e) MessageBox ("PBDOM_EXCEPTION", pbdom_e.GetMessage()) end try
Usage
This method checks to see if this PBDOM_ATTRIBUTE object contains any child PBDOM_OBJECTs and returns true if it does. Note that according to the W3C DOM specification, a DOM Attribute Node can contain only Text and Entity Reference Nodes, therefore a PBDOM_ATTRIBUTE object can contain only PBDOM_TEXT and PBDOM_ENTITYREFERENCE objects.
Even if a PBDOM_ATTRIBUTE object's text value is an empty string, it always contains at least one PBDOM_TEXT object that represents the empty string.