GetOwnerDocumentObject

Description

Returns the PBDOM_DOCUMENT object that owns the PBDOM_ATTRIBUTE.

Syntax

pbdom_attribute_name.GetOwnerDocumentObject()

Argument

Description

pbdom_attribute_name

The name of the PBDOM_ATTRIBUTE


Return value

PBDOM_DOCUMENT. The PBDOM_DOCUMENT that owns the PBDOM_ATTRIBUTE object from which the GetOwnerDocumentObject method is invoked.

A return value of null indicates the PBDOM_ATTRIBUTE object is not owned by any PBDOM_DOCUMENT.

Examples

The GetOwnerDocumentObject method can be used to identify the PBDOM_DOCUMENT object that owns a PBDOM_ATTRIBUTE object.

Here, the BuildFromString method is used to create the following PBDOM_DOCUMENT object, pbdom_doc, using an XML string:

<abc  My_Attr="My Attribute Value">
   <data>Data </data>
</abc>

The GetAttribute method is used to obtain the attribute from the root element of pbdom_doc. This value is assigned to the PBDOM_ATTRIBUTE object pbdom_attr. The GetOwnerDocumentObject method is used to obtain the pbdom_doc that owns pbdom_attr. The result of the GetOwnerDocumentObject method is assigned to the PBDOM_DOCUMENT object pbdom_doc_2. Then pbdom_doc_2 is compared to pbdom_doc using the Equals method, and the result is displayed in a message box.

PBDOM_Builder pbdombuilder_new
pbdom_document pbdom_doc
pbdom_document pbdom_doc_2
PBDOM_ATTRIBUTE pbdom_attr
string strXML = "<abc  My_Attr=~"My Attribute  Value~"><data>Data </data></abc>"

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

  pbdom_attr = pbdom_doc.GetRootElement(). &
     GetAttribute("My_Attr")
  pbdom_doc_2 = pbdom_attr.GetOwnerDocumentObject()

  if (pbdom_doc.Equals(pbdom_doc_2)) then
     MessageBox ("Equals", "pbdom_doc equals " &
       + "pbdom_attr.GetOwnerDocumentObject()")
  end if

  Destroy pbdombuilder_new

CATCH (PBDOM_Exception except)
  MessageBox ("Exception Occurred", except.Text)
END TRY

See also

GetOwnerElementObject

SetOwnerElementObject