|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: The subsetting has begun
On Wednesday 26 February 2003 16:28, Simon St.Laurent wrote:
> alaric@a... (Alaric B. Snell) writes:
> >It's not a DAG; you can't share subtrees. It's a tree!
>
> I share subtrees (chapters in DocBook) on a daily basis and even get
> paid for it.
Oh, you mean by having multiple references to the same entity? True, I'd not
included that. And that tends to crop up in the implementation as duplication
of the shared subtree; each node in the DOM can only have one parent, after
all.
> How exactly do you mean "you can't share subtrees"?
Each node only having one parent.
This is a valid DAG:
A
/ \
V V
B C
\ /
V V
D
In XML, the best you can do is:
<A>
<B>
<D/>
</B>
<C>
<D/>
</C>
</A>
You rightly suggest:
<!DOCTYPE A [
<!ENTITY d "<D/>">
]>
<A>
<B>
&d;
</B>
<C>
&d;
</C>
</A>
...but I suspect, in practice, that it would be hard for a processor to (when
processing D) note that it had two parents unless it did all its own entity
expansion and kept track of that explicitly. Indeed, if you load that into a
DOM, add an attribute to D (having obtained the ref to D via B) and save it
out, you'll probably get:
<A>
<B>
<D foo="bar"/>
</B>
<C>
<D/>
</C>
</A>
rather than:
<!DOCTYPE A [
<!ENTITY d "<D foo='bar'/>">
]>
<A>
<B>
&d;
</B>
<C>
&d;
</C>
</A>
In an s-expr the DAG would be written something like:
(A
(B @d: (D))
(C @d@))
That's explicit when the s-expre is loaded into memory, if you write it back
out again from memory it'll be the same, modulo the label 'd' probably being
just replaced with '0' or something. And if you'd modified (D) to (D foo:
'bar'), then it would change under C as well as under B, since it is *the
same* node in both places.
ABS
--
A city is like a large, complex, rabbit
- ARP
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








