Java Reference
In-Depth Information
person (firstname, lastname)> , <!ELEMENT lawyer (firstname,
lastname)> , and <!ELEMENT accountant (firstname, lastname)> .
Eachelementcontainsrepeatedchildelementcontent.Ifyouneedtoaddanotherchild
element(suchas middleinitial ),you'llneedtomakesurethatalltheelementsare
updated; otherwise, you risk a malformed DTD. Parameter entities can help you solve
this problem.
Parameterentitiesareclassifiedasinternalorexternal.An internal parameter entity
isaparameterentitywhosevalueisstoredintheDTD,andhastheform <!ENTITY %
name value > ,where name identifies theentity and value specifies itsvalue. For
example, <!ENTITY % person-name "firstname, lastname"> declares
a parameter entity named person-name with value firstname, lastname .
Oncedeclared,thisentitycanbereferencedinthethreepreviouselementdeclarations,
as follows: <!ELEMENT salesperson (%person-name;)> , <!ELEMENT
lawyer (%person-name;)> , and <!ELEMENT accountant (%person-
name;)> .Insteadofadding middleinitial toeachof salesperson , lawyer ,
and accountant , as was done previously, you would now add this child element
to person-name , as in <!ENTITY % person-name "firstname,
middleinitial, lastname"> , and this change would be applied to these ele-
ment declarations.
An external parameter entity isaparameterentitywhosevalueisstoredoutsidethe
DTD.Ithastheform <!ENTITY % name SYSTEM uri > ,where name identifies
the entity and uri locates the external file. For example, <!ENTITY % person-
name SYSTEM "http://www.tutortutor.ca/entities/names.dtd">
identifies names.dtd asstoringthe firstname, lastname texttobeinsertedin-
toaDTDwherever %person-name; appearsintheDTD.Thealternative <!ENTITY
% name PUBLIC fpi uri > form can be specified.
Note ThisdiscussionsumsupthebasicsofDTD.Oneadditionaltopicthatwasnot
covered(forbrevity)is conditional inclusion ,whichletsyouspecifythoseportionsof
aDTDtomakeavailabletoparsers,andistypicallyusedwithparameterentityrefer-
ences.
XML Schema
XML Schema isagrammarlanguagefordeclaringthestructure,content,and semantics
(meaning) of an XML document. This language's grammar documents are known as
schemas that are themselves XML documents. Schemas must conform to the XML
Schema DTD (see http://www.w3.org/2001/XMLSchema.dtd ) .
Search WWH ::




Custom Search