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

Re: Alternative "character entity" proposal


cross reference normalization
Richard Tobin writes:
 > The syntax for declaring a single entity is an attribute of the
 > form:
 > 
 >    xmlent:eacute="é"
 > 
 > Within the scope of the element with that attribute, é will refer
 > to the e-acute character.
 > 
 > The replacement text is not restricted to a single character:
 > 
 >    xmlent:author="Richard Tobin"
 > 
 > A file of entity declarations can be specified by an attribute of the
 > form:
 > 
 >    xmlentfile="http://example.org/ents"
 > 
 > or more than one file:
 > 
 >    xmlentfile="http://example.org/ents1 http://example.org/ents2"
 > 
 > These files must contain a single element, whose name is arbitrary,
 > and that element may have xmlent:* and xmlentfile attributes.  All the
 > entities declared in the file (and recursively) are in scope within
 > the element with the xmlentfile attribute.

I am not sure I like your proposed file format. I would rather the file
declared entities using elements, since the entities described by the file
have different scope to entities declared using attributes --- they apply not
to the scope of the declaring element, but to the scope of an element in the
XML document that refers to this file. How about:

<xmlent:entities>
  <xmlent:entity name="eacute" value="&#xe9;"/>
  <xmlent:entity name="author" value="Richard Tobin"/>
  <xmlent:include href="http://www.example.com/another_entity_file.xml"/>
</xmlent:entities>

That would also allow entities to be declared on these elements that only
applied within the entity file:

<xmlent:entities xmlent:foo="foo bar flibble">
  <xmlent:entity name="foo1" value="&foo; 1"/>
  <xmlent:entity name="foo2" value="&foo; 2"/>
</xmlent:entities>

 > Within the scope of such declarations, references to the entities are
 > both well-formed and valid.  This implies a new XML version number.
 > 
 > There are many variations possible: the single inline declaration
 > could be removed; the file syntax could use elements, the entity names
 > could be namespaced, and so on.  The key point is to have a scoped
 > mechanism for declaring internal entities using xml-instance syntax.

Does "the scope of the element with that attribute" include other attributes
on that element? If so, is ordering important? 

What level of attribute value normalization and entity expansion is performed
on the text values provided for these attributes?

e.g. is the following valid?

<abc xmlent:aaa="&zzz;" xmlent:zzz="hello"/>

These questins are important because it determines how much of an existing
parser/tool is affected by the change. If ordering is important, then existing
non-validating XML transformation tools that reorder attributes may
inadvertantly break an XML document if they are not aware of xmlent. 

Likewise, if normalization *does* happen, then it is important that entities
are declared before they are used --- in which case the parser may have to
read all attributes before normalizing any in case they cross-reference. OTOH,
if normalization *doesn't* happen, this is distinct from normal attribute
processing, so requires a change there.

Anthony
-- 
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.


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-2007 All Rights Reserved.