PBDOM_ATTRIBUTE:
GetOwnerElementObject method
Description
Returns
the owner PBDOM_ELEMENT of this PBDOM_ATTRIBUTE.
If there is no owner element, null is returned.
Syntax
1 |
<span>pbdom_attribute_name</span>.GetOwnerElementObject( ) |
Argument |
Description |
---|---|
pbdom_attribute_name |
The name of the PBDOM_ATTRIBUTE |
Return Values
PBDOM_ELEMENT. The owner PBDOM_ELEMENT of
this PBDOM_ATTRIBUTE or null if this
PBDOM_ATTRIBUTE has no owner element.
Throws
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE – This PBDOM_ATTRIBUTE
object’s internal implementation is null.
The occurrence of this exception is rare but can take place if severe
memory corruption occurs.
Examples
This example creates a PBDOM_DOCUMENT from
a string strXML in which the abc root
element contains one attribute, My_Attr.
The code gets this attribute, calls GetOwnerElementObject on
it to obtain the owner element, then calls GetName to
return the string abc
.
Finally, it sets My_Attr as an attribute
of the child element Data:
1 |
PBDOM_BUILDER     pbdombuilder_new<br>PBDOM_DOCUMENT    pbdom_doc<br>PBDOM_ATTRIBUTE   pbdom_attr<br>PBDOM_ELEMENT     pbdom_elem<br>string strXML = "<abc My_Attr=~"My Attribute Value~"><data>Data</data></abc>"<br> <br>TRY<br>  pbdombuilder_new = Create PBDOM_Builder<br>  pbdom_doc = pbdombuilder_new.BuildFromString (strXML)<br> <br>  // Get the attribute<br>  pbdom_attr = pbdom_doc.GetRootElement(). &<br>     GetAttribute("My_Attr")<br> <br>  MessageBox ("pbdom_attr Owner Element Name", &<br>     pbdom_attr.GetOwnerElementObject().GetName())<br> <br>  pbdom_attr.Detach()<br> <br>  pbdom_elem = pbdom_doc.GetRootElement(). &<br>     GetChildElement("data")<br>  pbdom_elem.SetAttribute (pbdom_attr)<br> <br>  MessageBox ("pbdom_attr Owner Element Name", &<br>     pbdom_attr.GetOwnerElementObject().GetName())<br> <br>  Destroy pbdombuilder_new<br>  Destroy pbdom_doc<br> <br>CATCH (PBDOM_Exception except)<br>  MessageBox ("Exception Occurred", except.Text)<br>END TRY |