Java Reference
In-Depth Information
in frying pan with one margarine-smeared side in
contact with pan. Fry for a
couple of minutes and flip. Fry other side for a
minute and serve.
</r:instructions>
</p>
</r:recipe>
</body>
</html>
Listing 10-6
specifies a default namespace for the XHTML language. No XHTML
elementtagneedstobeprefixedwith
h:
.However,recipelanguageelementtagsmust
still be prefixed with the
r:
prefix.
Comments and Processing Instructions
XMLdocumentscancontaincomments,whicharecharactersequencesbeginningwith
Commentsareusedtoclarifyportionsofadocument.Theycanappearanywhereafter
theXMLdeclarationexceptwithintags,cannotbenested,cannotcontainadoublehy-
phen(
--
)becausedoingsomightconfuseanXMLparserthatthecommenthasbeen
closed,shouldnotcontainahyphen(
-
)forthesamereason,andaretypicallyignored
during processing. Comments are not content.
XML also permits processing instructions to be present. A
processing instruction
is an instruction that is made available to the application parsing the document. The
instruction begins with
<?
and ends with
?>
. The
<?
prefix is followed by a name
known as the
target
. This name typically identifies the application to which the pro-
cessing instruction is intended. The rest of the processing instruction contains text
in a format appropriate to the application. Two examples of processing instructions
are
<?xml-stylesheet href="modern.xsl" type="text/xml"?>
(as-
sociate an eXtensible Stylesheet Language [XSL] style sheet [see
ht-
PHP code */ ?>
(passaPHPcodefragmenttotheapplication).AlthoughtheXML
declaration looks like a processing instruction, this is not the case.
Note
The XML declaration is not a processing instruction.