SAX2: Namespace proposal

David Megginson david at megginson.com
Mon Dec 20 16:03:22 GMT 1999


Miles Sabin <msabin at cromwellmedia.co.uk> writes:

> > If I were doing it over, though, I would actually call 
> > java.lang.String.intern once for each of the strings in the 
> > intern table so that they were == to the regular intern'ed 
> > versions.
> 
> Try it, but I think you'll be more likely to lose than gain.

I'd appreciate more information here -- if I call
java.lang.String.intern the first time I add a string to the intern
table, then the cost is proportional to the number of entries in the
table, not the number of accesses.

Or, in plainer English, if the XML name "div" appears 20,000 times in
my document, and I have my own custom intern() routine that calls
java.lang.String.intern only when a new name is added to the table, I
will still incur the cost of java.lang.String.intern only once, not
20,000 times.  The benefit is that my interned strings will still be
== to those from java.lang.String.intern.  I wish that I had done it
this way for AElfred.

> But all this seems to suggest that the use of java.lang.String.
> intern() and java.util.Hashtable isn't that good an idea.
> Insofar as SAX defines interfaces you can leave the choice to
> implementors. But wiring them into the implementation of SAX 
> utility classes (eg. your NSUtils) would mean that we don't
> get the option.

I think that NSUtils is dead -- it was a trial balloon, and a pretty
successful one as far as it went.  I am convinced that the
single-string approach is not suitable for Namespace-qualified names
in SAX2.


All the best,


David

-- 
David Megginson                 david at megginson.com
           http://www.megginson.com/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list