Chapter 5, Representing and Processing Rich Text
XFA Specification
Representation of Rich Text Across XML and XFA DOMs
189
contains a pointer to the corresponding node in the XML Data DOM. However, XFA-SOM does not provide
access to that pointer, so access from script to the XML Data DOM is application dependent.
For example, the following XML fragment contains rich text. The rich text content is highlighted.
<message>
<p xmlns="http://www.w3.org/1999/xhtml">
You owe <b>$25.00</b>. Please pay up!
</p>
</message>
After loading, the above fragment is represented in the XFA Data DOM as follows.
[dataValue message = "You owe $25.00. Please pay up!"
contentType="text/html"]
In addition to the above constraints, when specified via a
contentType
attribute on the enclosing
element, the rich text content must have a single outer element. Only white space is allowed within the
region of rich text content and outside the outer element.
The data loader may emit a warning message when it encounters a construct that violates the above rule.
How the application subsequently processes the affected content is implementation defined.
The content in the following example is illegal because the rich text is not enclosed within a single outer
element.
<message xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
xfa:contentType="text/html">
You owe <b>$25.00</b>. Please pay up!
</message>
In the example, the
message
element is not part of the rich text because the
contentType
attribute
applies to the content of the declaring element but not to the element itself. Hence, the rich text does not
have include an enclosing element. However, it would not be a good idea to declare that the
message
element was part of the rich text, because HTML markup does not include a
message
element. Rather, the
above example of illegal content could be made legal by wrapping the text in a
span
element as follows:
<message xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
xfa:contentType="text/html">
<span>You owe <b>$25.00</b>. Please pay up!</span>
</message>
Properties of XFA Template DOM Objects That Represent Converted Rich Text
The template loader creates a node in the XFA Template DOM for the
exData
object. The node has
nothing below it nor does it not have a
value
property. The
exData
object has a pointer into the XML
(not XFA) Template DOM, which allows the XFA processing application to read the original rich text. Each
node in the XFA Template DOM contains a pointer to the corresponding node in the XML Template DOM.
However, XFA-SOM does not provide access to that pointer, so any access from scripts to the XML Template
DOM is application dependent.
The following presents several examples of template expressions related to rich text.
Example 5.1
<draw … >
<ui/>
A draw element that includes rich text