
However, when writing the document, you decide. If your applications don’t
need entities, don’t use them. If you are happy with ASCII, stick to it. Most
applications need few of the features of XML besides the tagging mecha-
nism.
Therefore, although a typical XML parser is a thousand lines of code, a sim-
ple but effective generator can be written in a dozen lines.
This chapter looks at both approaches. You’ll start by using a DOM parser
to generate XML documents and then you’ll see how to write your own gen-
erator. Finally, you will see how to support different DTDs.
The techniques are illustrated with JavaScript but port easily in to Java.
Modifying ...