xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Heinz" <AHe...@exstream.com>
Subject RE: xerces "style"???
Date Tue, 27 Apr 2004 17:48:30 GMT
It sounds like you are doing SAX, yes?

I use a simple list (stack) to maintain state.  I tokenize my element and attribute names
into integers.  In some cases, I use a hash table to index function pointers by token.  In
other cases, I just switch (ugh) on the token; not much better than if/elsif.

Adam Heinz
Senior Software Developer
Exstream Software

-----Original Message-----
From: Matt Garman [mailto:garman@raw-sewage.net]
Sent: Tuesday, April 27, 2004 12:06 PM
To: xerces-c-dev@xml.apache.org
Subject: xerces "style"???

Hello!

I'm not sure if this is the right place to ask this kind of question or
not.  If this is inappropriate for this list, I apologize (and request
suggestions on other forums).

Anyway, I'm using xerces-c to read in some fairly complicated XML files.
The files are complicated in that there are a lot of different elements
and data types.

What I'm concerned about is keeping my code as readable, maintainable,
and simple as possible.  Is there a elegant way to maintain all element
information in code?

Right now, in my Handler's startElement() method, I essentially have a
lengthy if/else if block (and sometimes some other logic) to keep track
of state (i.e. what element I'm currently looking at).

Granted the code is simple, but it's certainly not pretty, and (as a
rule of thumb) when I start writing ugly code, I wonder if I'm missing
something.

Any thoughts here?  Is there any existing code that might give me some
good ideas on how to best structure my program?  E.g., some example
programs that are a little more substantial than those distributed with
xerces-c?

Thanks!
Matt

-- 
Matt Garman
email at: http://raw-sewage.net/index.php?file=email

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Mime
View raw message