Lists Home |
Date Index |
If entity declarations for simple string replacements had a syntax and
scoping similar to xml namespaces it could serve as a much simpler
replacement for namespaces -- e.g., consider:
<foo xmlent:an_entity = "replacement text" >&an_entity;</foo>
Now imagine if element and attribute names could be URIs and those
references to those names could start with an entity reference.
Voila, no need for namespaces:
No problem with QNames in CDATA since the mapping is exposed to the parser:
(Obviously the "entity reference in a name" syntax could be made more
pleasing to look at and type.)
Because URIs can be element and attribute names, we can throw away the
mapping and allow it to be canonically equivalent to:
No problem with QNames in CDATA since the mapping is exposed to the
just a thought...
On Tue, 08 Feb 2005 14:12:11 -0800, Bob Foster <email@example.com> wrote:
> Norman Walsh wrote:
> > / Bob Foster <firstname.lastname@example.org> was heard to say:
> > | One radical idea would be to define
> > | parseable entities in XML, in a
> > | separate entity namespace, using a
> > | simple first-definition-wins rule and
> > | XInclude for the external ones. I
> > | wonder why nobody's proposed that? Oh,
> > | wait, a number of people have proposed
> > | that. They just get slapped around
> > | here until they go away. ;-}
> > That may be the right answer, if we have to go that far, but it's not
> > without complications that would need to be addressed. For one thing,
> > how would these extra elements interact with validity assessment? For
> > another, would you allow the declarations to be scoped? If yes, then
> > that must be first declaration in scope. If not, how do you deal with
> > transclusion? Are the entity references manifest in the parsed document?
> > Do they survive parsing and re-seralization? Etc.
> All good questions. Especially the etc. ;-}
> First of all, this could be implemented today with no change to XML by a
> preprocessor that simply removed all elements from the "entity
> namespace" and expanded all references. It would be necessary that
> references _not_ use the & character or any other that might interfere
> with normal parsing. It is not necessary to allow definitions within
> expansion text. If the preprocessor went to text which was then
> reparsed, no issues except performance. This also deals with the
> validation question. And would collect valuable experience.
> If it were, e.g., the head of a SAX stream, it would need to recursively
> parse the result of expansion.
> I believe the technical term for things like scoping and transclusion is
> "piling on". There is a penalty for that. ;-} Today's entities don't
> support either.
> Round-tripping is, as today, bothersome. XML doesn't require that
> validating parsers report entity references, in fact it appears to
> require they don't. Some do anyway. But expanded internal GE references
> in attribute values are not reported by DOM or SAX. Etc. Could one write
> parser implementations that preserved references as well as they are
> preserved today for entities? Sure, but they would also need to preserve
> definitions, which to validate would mean that schemas would need to
> explicitly allow the definitions or be applied through, e.g., NVDL.
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> The list archives are at http://lists.xml.org/archives/xml-dev/
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>