Java Reference
In-Depth Information
This example defines a parameter entity named requiredAttribute , and then
uses it as part of an attribute definition.
<!ENTITY % requiredAttribute "CDATA #REQUIRED">
<!ATTLIST Order orderNumber %requiredAttribute>
It is the same as the following:
<!ATTLIST Order orderNumber CDATA #REQUIRED>
Parameter entities can only be used in the DTD itself, and not in the XML
document.
XML D ECLARATION
An XML document begins by identifying itself as an XML document. The follow-
ing represents a typical introduction to an XML document:
<?xml version="1.0" standalone="yes" encoding="UTF-8"?>
<!DOCTYPE Order [
... <! -- DTD specifications -->
]
The first expression declares the XML version to which the document con-
forms. The document is a version 1.0 document.
The document is also a standalone XML document, without references to other
documents. Since it is a standalone document, it must contain its DTD, if one ex-
ists. It is possible for a simple standalone XML document to have no DTD.
Finally, the first line states that the document can contain only 8-bit UTF-8
bytes. In UTF-8, a “character” can be represented in a single byte for the traditional
ASCII characters, and non-ASCII characters can be represented in a sequence of
multiple bytes.
An XML document can contain 16-bit characters, similar to Unicode in Java.
If this document were a 16-bit document, the required syntax would be encoding=
"UTF-16" . However, almost every tool and every platform supports the UTF-8 cod-
ing scheme; support for any other scheme is quite limited. So be sure to do careful
research before using any coding scheme other than UTF-8.
The next line in the type declaration identifies the document type as Order . An
Order comprises all the elements and attributes specified. These directives will be
included inside the braces ([]).
Search WWH ::




Custom Search