GetBooleanValue

Description

Obtains the value of a PBDOM_ATTRIBUTE object in boolean form.

Syntax

pbdom_attribute_name.GetBooleanValue()

Argument

Description

pbdom_attribute_name

The name of the PBDOM_ATTRIBUTE


Return value

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 string value

GetBooleanValue

1

true

0

false

TRUE

true

FALSE

false

ON

true

OFF

false

YES

true

NO

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:

PBDOM_BUILDER          pbombuilder_new
PBDOM_DOCUMENT         pbdom_doc
PBDOM_ATTRIBUTE        pbdom_attr
string strXML = "<abc My_Boolean_Attribute =~"on~"><data An_Attribute=~"Some Text~">Data</data></abc>"

TRY
  pbdombuilder_new = Create PBDOM_Builder
  pbdom_doc = pbdombuilder_new.BuildFromString (strXML)

  pbdom_attr = pbdom_doc.GetRootElement(). &
     GetAttribute("My_Boolean_Attribute")

  MessageBox ("Boolean Value", &
     string(pbdom_attr.GetBooleanValue()))


  Destroy pbdombuilder_new
  Destroy pbdom_doc
CATCH (PBDOM_Exception except)
  MessageBox ("Exception Occurred", except.Text)
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.

See also

SetBooleanValue