Lists Home |
Date Index |
Norman Walsh wrote:
> / Bob Foster <email@example.com> 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
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.