OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   SAX and stuff ...

[ Lists Home | Date Index | Thread Index ]
  • From: Tony Pelton <tony.pelton@spark.com>
  • To: "Xml-Dev (E-mail)" <xml-dev@lists.xml.org>
  • Date: Tue, 25 Jul 2000 10:44:10 -0700


All,

I may not have done enough reading and research on this subject ... but ...

Using SAX and issues of performance.

I have now done a handful of "extends HandlerBase" implementations to parse
some XML messages in our messaging system ... and have found myself in this
pattern of writing code like this ...

startElement(String name, AttributeList atts)
{
	if(name.equals("SOMETAGIAMINTERESTEDIN"))
	{
		doSomething(attributes);
		return;
	}
	<... repeat for next tag ...>
	<... and so on ...>
}

... so first question ...

1. Is this a practical, reasonable and expected approach to doing SAX
parsing for a handful of fairly simple but potentially large XML messages
that we have brewed "in-house" and have not developed DTD's for ?

The reason that I ask is that on some of the messages ... I might have 10+
elements that I am looking for events on ... so that I can "do stuff".

I then find myself thinking about the number of "if's" my code is performing
on every startElement() ... and then I find myself putting the "if's" that I
expect to get more of ... before the one's I expect less of ...

Then I get worried that I am being "kludgy" ...

2. Assuming that I am not egregiously off on how I am implementing my SAX
code ...

Using the SAX parser from Xerces (which I guess is Dave Megginson's ? are
there others ?) is it a safe assumption that the SAX parser does _not_ do
String intern()ing ... and if so ... for performance ... I would assume that
doing my own "up front" String interning of all of my expected element names
on JVM startup ... would behoove me ?

Thanks for any insight and shared experience ...
Tony

PS. I have watched with great interest the 'ebb and flow' conversation
regarding the issue of academic versus pragmatic design and development of
XML and other such'isms ... as it strikes dear to my heart ... I am a simple
guy ... who wants to design and build great software using "smart"
technology that I can research, learn about, and implement in a time frame
that makes sense given the pace of the domain I am in.




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS