PBDOM_EXCEPTION:
GetExceptionCode method
Description
Returns
the code of the exception being thrown.
Syntax
1 |
<span>pbdom_exception</span>.GetExceptionCode() |
Argument |
Description |
---|---|
pbdom_exception |
The name of a PBDOM_EXCEPTION object |
Return Values
Long. The code value associated with
the exception being thrown.
Examples
In this example, an attempt to call the PBDOM_ELEMENT GetAttribute method
on the root element of a PBDOM_DOCUMENT with the parameter xmlns:nuskin causes
an exception to be thrown, because the name is not a valid NCName
(no-colon-name). The correct way to get an attribute that belongs
to a namespace is to use the namespace version of the PBDOM_ELEMENT GetAttribute method.The
EXCEPTION_INVALID_NAME (code value 11) exception
is thrown and is displayed in a message box :
1 |
PBDOM_DOCUMENT   pbdom_doc1<br>PBDOM_DOCUMENT   pbdom_get_doc<br>PBDOM_ELEMENT   pbdom_elem_root<br>PBDOM_ATTRIBUTE   pbdom_attr<br>PBDOM_OBJECT     pbdom_obj<br> <br>try<br>  pbdom_doc1 = Create PBDOM_DOCUMENT<br> <br>  pbdom_doc1.NewDocument("nuskin", &<br>     "http://www.nuskin.com", "nuskin:root", "", "")<br>  pbdom_elem_root = pbdom_doc1.GetRootElement()<br>  pbdom_attr = &<br>   pbdom_elem_root.GetAttribute("xmlns:nuskin")<br> <br>catch (PBDOM_EXCEPTION pbdom_except)<br>  MessageBox ("Exception", "Code : " & <br>     + string(pbdom_except.GetExceptionCode()) &<br>     + "~r~nText : " + pbdom_except.Text)<br>end try |
Usage
For a list of exception codes, see “PBDOM exceptions”. For a description
of the conditions under which each exception can occur, see “PBDOM exception descriptions”.
See Also
-
GetAttribute Syntax 2 (PBDOM_ELEMENT)
-
GetMessage and SetMessage in
the PowerScript Reference.