Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg7068951

310 HOUR 21: Reading and Writing XML Data


Q&A
Q. What’s the purpose of the DOCTYPEstatement in the XML file produced
by the PropertyFileCreatorapplication?
A. 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 find references to each of
the elements and attributes contained in the XML file produced by the
Java library’s Propertiesclass.
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.

Q. Are the Hatfields and McCoys still feuding?
A. The West Virginia and Kentucky families are on good terms 121 years
after the last casualty in their infamous 35-year conflict.
In 1979,Hatfields and McCoys got together to play the TV game show
Family Feudfor a week. A pig was kept on stage and awarded to the
winning family.
In 2003,a formal peace treaty was reached between the families in
Pikeville,KY.
The Hatfield-McCoy Trails,500 miles of trails for recreational off-road
driving,were established in West Virginia in 2000 and expanded over
the next decade.

Workshop
To s e e w h e t h e r y o u r k n o w l e d g e o f X M L p r o c e s s i n g i n J av a i s we l l - f o r m e d ,
answer the following questions.

Quiz



  1. Which of the following terms should not be used to complement XML
    data that is properly formatted?
    A. This data is well formed.
    B. This data is valid.
    C. This data is dy-no-mite!

Free download pdf