[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] SAX and stuff ...
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.
|
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
|