PBDOM_ATTRIBUTE:
HasChildren method
Description
Determines
whether this PBDOM_ATTRIBUTE object contains any child PBDOM_OBJECTs.
Syntax
1 |
<span>pbdom_attribute_name</span>.HasChildren() |
Argument |
Description |
---|---|
pbdom_attribute_name |
The name of the PBDOM_ATTRIBUTE |
Return Values
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:
1 |
PBDOM_BUILDER pbdom_buildr<br>PBDOM_DOCUMENT pbdom_doc<br>PBDOM_ATTRIBUTE pbdom_attr<br>string strXML = "<root attr=~"~"></root>"<br> <br>try<br>  pbdom_buildr = Create PBDOM_BUILDER <br>  pbdom_doc = pbdom_buildr.BuildFromString(strXML)<br>  <br>  pbdom_attr = pbdom_doc.GetRootElement(). &<br>     GetAttribute("attr")<br>  <br>  if (pbdom_attr.HasChildren()) then<br>    PBDOM_OBJECT pbdom_obj_array[]<br>    long l = 0<br>    <br>    pbdom_attr.GetContent(pbdom_obj_array)<br>    <br>    for l = 1 to UpperBound (pbdom_obj_array)<br>      MessageBox ("Attr Child Object", &<br>         pbdom_obj_array[l].GetObjectClassString())<br>    next<br>    <br>  end if<br>  <br>catch (pbdom_exception pbdom_e)<br>  MessageBox ("PBDOM_EXCEPTION", pbdom_e.GetMessage())<br>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.