Java Reference
In-Depth Information
Figure 10-2. Google Chrome presents the recipe data via XHTML tags.
A tag's attributes don't need to be prefixed when those attributes belong to the ele-
ment.Forexample, qty isnotprefixedin <r:ingredient qty="2"> .However,
aprefixisrequiredforattributesbelongingtoothernamespaces.Forexample,suppose
you want to add an XHTML style attribute to the document's <r:title> tag, to
provide styling for the recipe title when displayed via an application. You can accom-
plishthistaskbyinsertinganXHTMLattributeintothetitletag,asfollows: <r:title
h:style="font-family: sans-serif;"> . The XHTML style attribute
has been prefixed with h: because this attribute belongs to the XHTML language
namespace and not to the recipe language namespace.
Whenmultiplenamespacesareinvolved,itcanbeconvenienttospecifyoneofthese
namespacesasthedefaultnamespace,toreducethetediuminenteringnamespacepre-
fixes. Consider Listing 10-6 .
Listing 10-6. Specifying a default namespace
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:r="http://www.tutortutor.ca/">
<head>
Search WWH ::




Custom Search