|
!ENTITY %
code_format "
CDATABog'liq Ceponkus, Hoodbhoy - Applied XML - Toolkit for Programmers!ENTITY %
code_format "
CDATA
">
<
!ENTITY %
default_value "
#REQUIRED
">
<
!ELEMENT
cars (car)+>
<
!ELEMENT
car (
#PCDATA
)>
<
!ATTLIST
car product_code
%
code_format
%
default_value
delivery_code
%
code_format
%
default_value
distributor_code
%
code_format
%
default_value>
]>
distributor
code ="J3 4212">
Model 2100ZX3
To force all the attribute values to have values without white space (that is, NMTOKEN),
you’d simply change the
<
!ENTITY %
code_format "CDATA">
line to:
<
!ENTITY %
code_format "NMTOKEN">
You could do a similar change with the %default_value line to change the default value of
the attributes.
External General Entity Declaration
General External entities declarations are made when you want to declare the existence
of an external object (e.g., a picture or another XML document) as an entity in your
document.
Let’s say we’ve got a proposal document that consists of an executive summary, a
discussion section, and a conclusion section. Each of these has been prepared and
stored as external documents. In that case, our external entity declarations could look like
this:
<
!DOCTYPE
proposal [
<
!ENTITY
executive_summary
SYSTEM
"executive_summary.xml">
<
!ENTITY
discussion
SYSTEM
"discussion.xml">
<
!ENTITY
conclusion
|
| |