[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Allowed PEReference usages

  • To: xml-dev@l...
  • Subject: Re: Allowed PEReference usages
  • From: Arjun Ray <aray@n...>
  • Date: Tue, 01 Jul 2003 22:32:40 +0000
  • In-reply-to: <Law11-F113g1WTp6AVj00032e97@h...>
  • References: <Law11-F113g1WTp6AVj00032e97@h...>

pereference
"Brett Kail" <junkaddr@h...> wrote:
 
| I've been reading the XML specs for some time now, and I am completely
| stumped attempting to understand the restrictions on PEReferences.

I don't blame you.  Each time I read the spec, the treatment of PEs seems
less clear.  I tend to view PEs as they are used in SGML; the XML spec is
supposed to place further restrictions - that is, I recall the discussions
while the spec was being developed.

In general, there are three rules to bear in mind:

  1.  Non-recursion: the replacement text of a PE can't have a reference 
      to the same PE, directly or indirectly.
  2.  Integral declarations: a declaration must begin and end in the same
      entity - hence the replacement text of PEs can't cause declaration 
      boundaries to be crossed.   
  3.  Integral tokens in declarations: a token (or "parameter" in SGML
      jargon - whence the name "parameter entity") in a declaration can't
      be "split" such that only part of it is an as yet unexpanded PEref.

Your examples all seem to deal with the third rule.

| Could someone please comment which pairs of definition/uses below are
| allowed?  An explanation or pointer to the relevant portion of the
| spec as to *why* the usage is valid/invalid would be extremely
| helpful.
| 
| <!ENTITY % pe "!ELEMENT e ANY">
| <%pe;>

No, because "<!ELEMENT" counts as one integral token.  Note: This is not
*strictly* true, but it helps to think of the keyword following the MDO
("<!") as part of the same token.

 
| <!ENTITY % pe "ELEMENT e ANY">
| <!%pe;>

No, same problem.
 
| <!ENTITY % pe "ELEMENT">
| <!%pe; e ANY>

Ditto.
 
| <!ENEITY %pe " ">
| <!ELEMENT%pe;e ANY>

Permissible in SGML - maintains integral character of relevant parameters.
Probably okay in XML.
 
| <!ENTITY % pe "!ELEM">
| <%pe;ENT e ANY>

No, same problem
 
| <!ENTITY % pe "ELEM">
| <!%pe;ENT e ANY>

Ditto.
 
| <!ENTITY % pe "Y">
| <!ELEMENT e AN%pe;>

Same problem: "ANY" is one token.
 
| <!ENTITY % pe "ELEMENT e">
| <!%pe; ANY>

No - "<!ELEMENT" is being split up.
 
| <!ENTITY % pe "x 'value'">
| <!ENTITY % %pe;>

Permissible in SGML - should be okay for XML.
 
| <!ENTITY % pe "% x 'val">
| <!ENTITY %pe;ue'>

No.  The replacement text between the single quotes counts as one token,
and is being split here.

Note that the integral token restriction doesn't apply when using PErefs
to paste together the content of replacement text in what is effectively a
single parameter in a PE declaration.  (In fact, that is how you might
"construct" tokens if needed.) 
 
| In addition, how does one declare a PE that contains a literal '%'?

Use a character reference in the replacement text.

| How about does one declare a PE that contains both a single and double
| quote?  

Ditto.

| Assuming that it is possible to declare a PE named 'percent' with a 
| literal '%', is the following allowed?
| 
| <!ENTITY %percent; x "value">

Permissible in SGML - should be okay in XML.

Note also that there are further restrictions in XML on PE usage in an
internal subset.

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.