Search

Languages

Other languages on request.

About Me

I am the "Lotus Technology & Productivity Advisor" for IBM Asia Pacific. I'm based in Singapore.

Ads by Google

Visitors

« IBM blissfully absent - PACE2005 | Main| About storms and compassion »

Insights into NotesSax Parser


I was working on a project that needs to import XML. Since the files could become rather big I opted not to use DXL but the NotesSAX parser class. When you are a Lotus Script die hard without much exposure to other languages the SAX parser has a "very first" for you: definition of event handlers. For those VB.NET, C#, Java and other buffs it's nothing special.
The nice thing about SAX parsers (compared to text parsing): they fix the character set for you. For example the snippet:
<company> Peter &amp; Pan</company>
 will arrive as a StartElement event, a series of Character events and one Stop event. The NotesSAX parser actually will deliver 3 Character events! Since the &amp; is an encoded entry, the text will be split into 3 and delivered as "Peter " "&" " Pan". Nota bene: there are leading and trailing spaces you can't trim. Typically you would create a steering object, that keeps the state where in XML stream you are and write out your text on a Element (either Start or End) into whatever you want to write to. I'll post some sample code for the Excel project soon.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::rolleyes:;-)

Disclaimer

This site is in no way affiliated, endorsed, sanctioned, supported, nor enlightened by Lotus Software nor IBM Corporation. I may be an employee, but the opinions, theories, facts, etc. presented here are my own and are in now way given in any official capacity. In short, these are my words and this is my site, not IBM's - and don't even begin to think otherwise. (Disclaimer shamelessly plugged from Rocky Oliver)

© 2003 - 2009 Stephan H. Wissel - all rights reserved as listed here: Creative Commons License
Unless otherwise labeled by its originating author, the content found on this site is made available under the terms of an Attribution/NonCommercial/ShareAlike Creative Commons License, with the exception that no rights are granted -- since they are not mine to grant -- in any logo, graphic design, trademarks or trade names of any type.

Get Firefox Use OpenDNS