Chapter 5, Representing and Processing Rich Text
XFA Specification
Representation of Rich Text Across XML and XFA DOMs
188
Additionally, rich text should include an
xfa:APIVersion
attribute to indicate the rich text support it
expects.
Representing Rich Text in the XFA Data DOM
Rich text does not appear within XFA Data DOM. XFA processors are required to perform some operations
directly upon the rich text (for example rendering it on a display). They do so by accessing the originating
XML DOM. Scripting languages may also make the associated rich text available but they are not required
to.
In the case of the XFA Template DOM, the rich text is simply excluded from the DOM. By contrast in the XFA
Data DOM the rich text is represented by plain unstyled text derived from the rich text. This ensures that
scripting languages can recognize and operate on the data regardless of styling. The relationship between
the XML Data DOM and the XFA Data DOM is discussed at greater length in
“XML Data DOM and XFA Data
DOM” on page 80.
Rich text converted into plain text for XFA DOMs
XML Template DOM
Markup stripped
from rich text
XFA Template DOM
XML Data DOM
Markup stripped
from rich text
XFA Data DOM
XFA Form DOM
Converting Rich Text into Plain Text
Rich text is converted to plain text in the following manner:
1. Start with a copy of the rich text including all markup.
2. Delete all start and end tags and empty elements (whether they represent supported markup or not).
3. Convert all XML character escapes to their literal form (for example,
"<"
to
"<"
).
4. Normalize the white space by replacing all contiguous sequences of white space and/or newline
characters with single spaces.
5. Trim any leading and trailing spaces.
Properties of XFA Data DOM Objects That Represent Converted Rich Text
When the data loader recognizes rich text, it sets the
contentType
property of the
dataValue
node
corresponding to the enclosing element to
"text/html"
. This property tells rich text capable
applications that they should look below the corresponding node of the XML Data DOM for the original
rich text. As mentioned in
“About the XFA Data DOM” on page 114,
each node in the XFA Data DOM
Home Index Bookmark Pages
Pages: Home Index All Pages