Q&A

Q1:What's the purpose of the DOCTYPE statement in the XML file produced by the PropertyFileCreator application?
A1: That's a reference to a document type definition (DTD), a file that defines the rules XML data must follow to be considered valid in its dialect.

If you load the web page referred to in that statement, http://java.sun.com/dtd/properties.dtd, you'll find references to each of the elements and attributes contained in the XML file produced by the Java 2 library's Properties class.

Although Sun provides this DTD, Java's official documentation indicates that it shouldn't be relied upon when evaluating property configuration data. Parsers are supposed to ignore it.

Q2:An XML file I want to load in a Java program makes use of indentation. ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.