|
Whitebeam Template Reference Documentation
|
XmlParser Template
text()
Generate the text representation of the XML subtree. ADVANCED.
Syntax
string = rb.XmlParser.text()
Parameters
The 'text' method takes no parameters
Results
The 'text' method returns string:
Type/Value | Range/Length | Description |
string |
  |
Return the text equivalent for the XML subtree.
|
Remarks
This method returns the currently accumulated
text for the specified tag (i.e. that object on which this method is invoked). The
result will be the text equivalent of the tag and all its children. Contrast this with
the behaviour of XmlTag.bodytext(),
which would NOT output the text for the node itself. Consider the following example:
<blockquote rb:id="node">
<ul>
<li>First
<li>Secind
<li>Third
<li>Fourth
</ul>
</blockquote>
And suppose we generate an XmlTag representation of this tree using
rb.page.tagtree() as follows:
var tags = rb.page.tagtree("node");
'tags' now references the 'blockquote' tag. Calling tags.text() would generate the entire
source text. contrast this with the behaviour of
XmlTag.bodytext()(), which would return
the entire source.
 |
You can call 'tag.text' as often as you like and each time a string will be generated
based on the last time the XML tree was executed. Note that the tree itself is
only regenerated by calling tag.regenerate()().
If the tag only contains static HTML then this makes no difference. If on the otherhand the
subtree contains active serv-side elements that to get the correct output based on the current
environment requires that the tag tree is regenerated for each dataset.
|
|
|
(loadtime : 253ms) |