What is the most efficient way to use SAX?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Toby_Saville
Posted On:   Sunday, May 12, 2002 08:50 PM

I am fairly new to XML processing, but based on articles i have read i have chosen to use the SAX parser. The best way i can figure to use the SAX parser is to create alot of global boolean variables. Set these variables in the start and end elements event methods, and then test these variables in the character event method to perform functions based on the element.
This ends up with a lot of if statements and code that heavily relies on the element names in the XML document (not good if someone wants to change the element names).
Is there a better way to use the SAX parser than global booleans?
Thanks, t0by

Re: What is the most efficient way to use SAX?

Posted By:   Bozidar_Dangubic  
Posted On:   Monday, May 13, 2002 05:41 AM

I am unclear about what you are trying to do with global booleans and why would you ever need them. in SAX, XML file is parsed sequentually and is event-based. so while you parse, certain events will occur and SAX parser will give you a notification via callbacks that certain event has occurred. I do not see a reason why you would need global booleans? so please try to explain exactly what it is that you are trying to do and perhaps we will be able to help you then.
About | Sitemap | Contact