Java Reference
In-Depth Information
However,forperformanceorotherreasons,youmightwanttheparsertoreadtheex-
ternalentity'svaluefromadifferentsystemidentifier,suchasalocalDTDcopy'ssys-
temidentifier.Youcanaccomplishthistaskbycreatingan entity resolver thatusesthe
publicidentifiertochooseadifferentsystemidentifier.Uponencounteringanexternal
entity, the parser calls the custom entity resolver to obtain this identifier.
Consider Listing 10-12 ' s formal specification of Listing 10-1 ' s grilled cheese sand-
wich recipe.
Listing 10-12. XML-based recipe for a grilled cheese sandwich specified in Recipe Markup Lan-
guage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE recipeml PUBLIC "-//FormatData//DTD RecipeML
0.5//EN"
"http://www.formatdata.com/re-
cipeml/recipeml.dtd">
<recipeml version="0.5">
<recipe>
<head>
<title>Grilled Cheese Sandwich</title>
</head>
<ingredients>
<ing>
<amt><qty>2</qty><unit>slice</unit></amt>
<item>bread</item>
</ing>
<ing>
<amt><qty>1</qty><unit>slice</unit></amt>
<item>cheese</item>
</ing>
<ing>
<amt><qty>2</qty><unit>pat</unit></amt>
<item>margarine</item>
</ing>
</ingredients>
<directions>
<step>Place frying pan on element and select medi-
Search WWH ::




Custom Search