Java Reference
In-Depth Information
Note
XMLandHTMLaredescendentsof
Standard Generalized Markup Language
(SGML)
, which is the original metalanguage for creating vocabularies—XML is es-
sentially a restricted form of SGML, while HTML is an
application
of SGML. The
keydifferencebetweenXMLandHTMListhatXMLinvitesyoutocreateyourown
vocabularieswiththeirowntagsandrules,whereasHTMLgivesyouasingleprecre-
atedvocabularywithitsownfixedsetoftagsandrules.XHTMLandotherXML-based
vocabulariesare
XML applications
.XHTMLwascreatedtobeacleanerimplementa-
tion of HTML.
Ifyouhaven'tpreviouslyencounteredXML,youmightbesurprisedbyitssimplicity
andhowcloselyitsvocabulariesresembleHTML.Youdon'tneedtobearocketscient-
isttolearnhowtocreateanXMLdocument.Toprovethistoyourself,checkout
Listing
Listing 10-1.
XML-based recipe for a grilled cheese sandwich
<recipe>
<title>
Grilled Cheese Sandwich
</title>
<ingredients>
<ingredient qty="2">
bread slice
</ingredient>
<ingredient>
cheese slice
</ingredient>
<ingredient qty="2">
margarine pat
</ingredient>
</ingredients>
<instructions>
Place frying pan on element and select medium heat.
For each bread slice, smear
one pat of margarine on one side of bread slice. Place
cheese slice between bread
slices with margarine-smeared sides away from the
cheese. Place sandwich in frying