PBDOM_TEXT – PB Docs 150

PBDOM_TEXT

The PBDOM_TEXT class derives from PBDOM_CHARACTERDATA
and represents a DOM text node in an XML document.

Methods

The PBDOM_TEXT class has no methods that are not
inherited from PBDOM_OBJECT or PBDOM_CHARACTERDATA.

Using PBDOM_TEXT objects

PBDOM_TEXT objects are commonly used to represent
the textual content of a PBDOM_ELEMENT or a PBDOM_ATTRIBUTE.
Although PBDOM_TEXT objects are not delimited by angle
brackets, they are objects and do not form
the value of a parent PBDOM_ELEMENT.

A PBDOM_TEXT object represented in graphical form
in a PBDOM tree is a leaf node and contains no child objects. For
example, Figure 14-4 represents the
following PBDOM_ELEMENT:

Figure 14-4: PBDOM_TEXT parent-child
relationship

domtext2.gif

The arrow indicates a parent-child relationship.

Occurrence of PBDOM_TEXTs

When an XML document is first parsed, if there is no markup
inside an element’s content, the text within the element
is represented as a single PBDOM_TEXT object. This PBDOM_TEXT
object is the only child of the element. If there is markup, it
is parsed into a list of PBDOM_ELEMENT objects and PBDOM_TEXT
objects that form the list of children of the element.

For example, parsing the following XML produces one PBDOM_ELEMENT that
represents <element_1> and
one PBDOM_TEXT that represents the textual content Some
Text
:

The <element_1> PBDOM_ELEMENT
has the PBDOM_TEXT object as its only child.

Consider this document:

Parsing this XML produces a PBDOM_ELEMENT that represents <element_1> and
its five children:

  • A PBDOM_TEXT representing Some
    Text

  • A PBDOM_ELEMENT representing <element_1_1/>

  • A PBDOM_TEXT representing More
    Text

  • A PBDOM_ELEMENT representing <element_1_2/>

  • A PBDOM_TEXT representing Yet
    More Text

Adjacent PBDOM_TEXT objects

You can create adjacent PBDOM_TEXT objects that represent
the contents of a given element without any intervening markup.
For example, suppose you start with this document:

Calling AddContent("More Text") on
the element_1 PBDOM_ELEMENT produces
the following result:

There are now two PBDOM_TEXT objects representing
“Some Text” and “More Text” that are adjacent to each other. There
is nothing between them, and there is no way to represent the separation
between them.

Persistence of PBDOM_TEXT objects

The separation of adjacent PBDOM_TEXT objects does
not usually persist between DOM editing sessions. When the document
produced by adding “More Text” shown in the preceding example is
reopened and reparsed, only one PBDOM_TEXT object represents
“Some TextMore Text”.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x