GetOwnerElementObject
Description
Returns the owner PBDOM_ELEMENT of this PBDOM_ATTRIBUTE. If there
is no owner element, null is returned.
Syntax
|
1 |
pbdom_attribute_name.GetOwnerElementObject( ) |
|
Argument |
Description |
|---|---|
|
pbdom_attribute_name |
The name of the PBDOM_ATTRIBUTE |
Return value
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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
PBDOM_BUILDER pbdombuilder_new PBDOM_DOCUMENT pbdom_doc PBDOM_ATTRIBUTE pbdom_attr PBDOM_ELEMENT pbdom_elem string strXML = "<abc My_Attr=~"My Attribute Value~"><data>Data</data></abc>" TRY pbdombuilder_new = Create PBDOM_Builder pbdom_doc = pbdombuilder_new.BuildFromString (strXML) // Get the attribute pbdom_attr = pbdom_doc.GetRootElement(). & GetAttribute("My_Attr") MessageBox ("pbdom_attr Owner Element Name", & pbdom_attr.GetOwnerElementObject().GetName()) pbdom_attr.Detach() pbdom_elem = pbdom_doc.GetRootElement(). & GetChildElement("data") pbdom_elem.SetAttribute (pbdom_attr) MessageBox ("pbdom_attr Owner Element Name", & pbdom_attr.GetOwnerElementObject().GetName()) Destroy pbdombuilder_new Destroy pbdom_doc CATCH (PBDOM_Exception except) MessageBox ("Exception Occurred", except.Text) END TRY |
See also