|
Microsoft Word Applied xml a toolkit for Programmers Wiley docBog'liq Ceponkus, Hoodbhoy - Applied XML - Toolkit for ProgrammersFigure 4.7:
Tree model of Attribute example.
- 105 -
CDATASection.
A CDATASection node is similar to a Text node, but can contain
markup. In other words, special characters such as < and > can be used within the XML
document without being interpreted as tags. This example yields a similar result as the
Text node example, except the node type of the bottommost node is CDATASection
instead of Text (see Figure 4.8). and are left as text and not interpreted as
element tags.
Alex]]>
Figure 4.8:
Tree model of CDATASection example.
DocumentType.
The DocumentType node (see Figure 4.9) represents a small subset of
a Document Type Definition (DTD). Unfortunately, only the and
tags from the DTD are exposed through the DOM. The representation of
only these two nodes is a known limitation of the DOM specification. The DocumentType
node is always a child of the Document node and is, in turn, a parent to a collection of
both Entity nodes and Notation nodes. The following XML document ends up creating a
DocumentType node.
]>
some text
- 106 -
Figure 4.9:
Tree model of DocumentType example.
Entity.
The Entity node (see Figure 4.10) provides a representation of the
tag used in a DTD. This Entity node can be accessed from the parent DocumentType
node. The various properties of the entity, such as the system id, public id, and notation
name, are modeled as Attr nodes and located as children of the Entity node.
Figure 4.10:
Tree model of Entity and Notation example.
Notation.
The Notation node (see Figure 4.10) provides a representation of the
tag used in a DTD. This node is placed at the same level in the tree as
the Entity node, as a child of the DocumentType node. The public id and system id of the
notation are turned into Attr nodes and placed under the Notation node. Figure 4.10
shows how and tags are modeled using nodes. In
Chapter 5
, we show that there is another method to access Entities and Notations.
Although the model shown here is correct, it should be noted that often other ways of
accessing elements could make Figure 4.10 change slightly.
|
| |