[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] Re: determining ID-ness in XML
- From: Rob Lugt <roblugt@elcel.com>
- To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>,Michael Fuller <msf@mds.rmit.edu.au>
- Date: Thu, 01 Nov 2001 11:55:31 +0000
Henry S. Thompson wrote
>
> 1) They're [PIs] not scoped, everything else about the language is.
> 2) They're not declared in the grammar (DTD/Schema)
>
These are the two reasons why I believe PIs may be the better approach.
Allow me to explain:
(2) is useful because it allows us to introduce new concepts retrospectively
without breaking existing applications and grammars.
<going long>
In my view the ideal solution to the ID-less problem would have been to make
use of the internal DTD subset. James Clark has pointed out [1] that this
is not suitable for streaming. As PIs can be placed after the prolog, they
are not subject to this restriction.
You say (1) that PIs are not scoped. This could possibly be useful. James
Clark [1] introduced xml:idatt with the concept of inheritance. However, I
can contrive an example where this would not be helpful:-
<root xml:idatt="id">
<foo id="a"/>
<foo id="b"/>
<foo id="c"/>
<!-- following have a id attr that should not be treated as ID -->
<bar id="a"/>
<bar id="c"/>
<bar id="d"/>
<root/>
The ugly solution would be to specify xml:idatt on each of the foos or each
of the bars. The other alternative of introducing a new parent element for
all of the bars may not be acceptable for the application/grammar.
The PI alternative has no such problems:
<root>
<?xml-typeinfo idnames="id"?>
<foo id="a"/>
<foo id="b"/>
<foo id="c"/>
<!-- following have a id attr that should not be treated as ID -->
<?xml-typeinfo idnames=""?>
<bar id="a"/>
<bar id="c"/>
<bar id="d"/>
<root/>
Conceptually, we could say that PIs do have scope. A reasonable definition
would be that they cover everything from the point of declaration to the end
of the containing element. This would be a similar kind of scope to
variables in C++. PIs occurring before the root element would have "file
scope", PIs occurring in element content would be 'visible' from the point
of declaration until the end of that element, including child elements
occurring after the PI, but not those occurring before it.
Regards
~Rob
--
Rob Lugt
ElCel Technology
http://www.elcel.com
[1] http://lists.xml.org/archives/xml-dev/200110/msg01051.html