I saw one DTD with following DTD declaration : <!ENTITY % p ''> i am not sure what does it mean. i looked in many places to find out but no luck. could someone pls explain the meaning of this one. this entity is used further as: <!ENTITY % pattern "%p;pattern"> what is the meaning of previous line ?? Thanks
Entities as variables used to define shortcuts to common text. They define text substitutions that need to occur in your XML document. They facilitate re-use, single point of modification and hence easy maintenance. Entity Syntax: <!ENTITY entity-name "entity-value"> Here is an example I took from www.xml101.com DTD Example: <!ENTITY writer "Jan Egil Refsnes."> --> means replace writer with the "Jan.." string <!ENTITY copyright "Copyright XML101."> --> means replace copyright with the the ..string
The entity value can be a string( as in the example above, ) or it can be an URI ie., an external resource that defines the value. Well, this is the most simplistic explanation. If you want to read W3 notes about entities, good place to go is the spec. I highly recommend you reading the Annotated XML spec that is so easy to understand unlike the original W3 spec that reads like a legal document! Hope this helps, ------------------ Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform. [This message has been edited by Ajith Kallambella (edited January 26, 2001).]
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Joined: Jan 26, 2001
Ajith Thanks for your reponse...but i wanted to konw the eact meaning of following declaration : <!ENTITY % p ''> tx
Joined: Mar 17, 2000
[Definition:] An entity reference refers to the content of a named entity. [Definition:] References to parsed general entities use ampersand (&) and semicolon ( ;) as delimiters. [Definition:] Parameter-entity references use percent-sign (%) and semicolon ( ;) as delimiters. If the keyword of the conditional section is a parameter-entity reference, the parameter entity must be replaced by its content before the processor decides whether to include or ignore the conditional section. An example: ( from W3C XML Spec <!ENTITY % draft 'INCLUDE' > <!ENTITY % final 'IGNORE' >
<![%draft;[ <!ELEMENT book (comments*, title, body, supplements?)> ]]> <![%final;[ <!ELEMENT book (title, body, supplements?)> ]]>
This little paragraph, and the example shown, document the key trick that makes conditional sections useful. Rather than having the actual words INCLUDE or IGNORE as the keyword, normally you'd have a parameter-entity reference, so that you could, by redeclaring that entity in the internal subset, switch back and forth between conditional sections. Clear as mud?? ------------------ Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform. [Ajith disabled smilies!] [This message has been edited by Ajith Kallambella (edited August 06, 2001).]
I highly recommend you reading the Annotated XML spec that is so easy to understand unlike the original W3 spec that reads like a legal document! aboslutely... Thanks for the Annotated link. Hope I can make more sense out of this. The orig spec is okay but, having a little more examples goes a long way.