[jdom-interest] EntityRef questions

Stefan ALBOI sbll at ss.pub.ro
Mon Jun 4 15:12:59 PDT 2001


> > I don't think about modifying external entities. Let's say no methods for
> > modifying external entities, but from the memory consumption point of view
> > it would be swell if an external parsed entity is stored expanded into
> > memory only once. I give you the example with 1 million references to an
> > external parsed entity again.
> 
> That gets difficult when someone wants to modify the content (because
> modification in one place would inadvertantly cause modification in a
> million).
> 
> -jh-
> 

I see no harm in making immutable Entity available for external
entities. In fact, I think is a good ideea. DOM useses both Entity and
EntityRef.

Here is another problem:
-------------------------------------------
<!DOCTYPE a [
<!ENTITY entit 'Text<b>content</b>Text'>
]>

<a>Text&entit;Text</a>
-------------------------------------------

The resulting tree for DOM & JDOM with Entity is:
1. a
   1. #text
   2. entit
      1. #text
      2. b
         1. #text
      3. #text
   3. #text

For JDOM with EntityRef we have:
1. a
   1. #text
   2. #text
   3. b
      1. #text
   4. #text
   5. #text

An entity contains a list of Strings, Elements, EntityRefs, PIs, Comments
and CDATAs.
Why not make available a method for adding a list of those objects to the
element's content? Element could have something like addContent(Collection
c). I know that's a little bit tricky because we don't have a common
parrent for those classes (other than Object), but I say
addContent(Collection c) could be very useful for developers.





More information about the jdom-interest mailing list