PBDOM_ATTRIBUTE:
GetBooleanValue method
Description
Obtains
the value of a PBDOM_ATTRIBUTE object in boolean form.
Syntax
1 |
<span>pbdom_attribute_name.</span>GetBooleanValue()<span></span> |
Argument |
Description |
---|---|
pbdom_attribute_name |
The name of the PBDOM_ATTRIBUTE |
Return Values
Boolean.
The following table lists the PBDOM_ATTRIBUTE string
values that are accepted as boolean and the corresponding return
values from the GetBooleanValue method.
PBDOM_ATTRIBUTE |
GetBooleanValue |
||
---|---|---|---|
|
true |
||
|
false |
||
|
true |
||
|
false |
||
|
true |
||
|
false |
||
|
true |
||
|
false |
Strings are treated without case sensitivity. If no conversion
can occur, the GetBooleanValue method throws
an exception.
Throws
EXCEPTION_DATA_CONVERSION – If
data conversion fails.
Examples
The GetBooleanValue can be used
to evaluate a PBDOM_ATTRIBUTE object as follows:
1 |
PBDOM_BUILDER          pbombuilder_new<br>PBDOM_DOCUMENT         pbdom_doc<br>PBDOM_ATTRIBUTE        pbdom_attr<br>string strXML = "<abc My_Boolean_Attribute =~"on~"><data An_Attribute=~"Some Text~">Data</data></abc>"<br> <br>TRY<br>  pbdombuilder_new = Create PBDOM_Builder<br>  pbdom_doc = pbdombuilder_new.BuildFromString (strXML)<br> <br>  pbdom_attr = pbdom_doc.GetRootElement(). &<br>     GetAttribute("My_Boolean_Attribute")<br> <br>  MessageBox ("Boolean Value", &<br>     string(pbdom_attr.GetBooleanValue()))<br>  Destroy pbdombuilder_new<br>  Destroy pbdom_doc<br>CATCH (PBDOM_Exception except)<br>  MessageBox ("Exception Occurred", except.Text)<br>END TRY |
The BuildFromString method is used to create
a PBDOM_DOCUMENT object, pbdom_doc,
using an XML string. The attribute value of the root element of pbdom_doc is
assigned to the PBDOM_ATTRIBUTE object pbdom_attr.
The attribute value, on, is evaluated with
the GetBooleanValue method. A message box reports
the return value of the GetBooleanValue method.