You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Reza Bagherian <re...@crossworlds.com> on 2000/11/08 18:37:49 UTC
?? SAX tips ??
I am writing a java program to parse a document using SAX.
The output of the parsing process is a huge hierarchical java object. I am
looking for tips in handling large documents with many embeded objects.
Instead of having a huge startElement(), character(), and endElement
methods, i am looking for ways to break down based on a more object oriented
paradigm.
please do let me know, If you have any tips on SAX to accomplish the goal.
Thanks, Reza
Re: ?? SAX tips ??
Posted by Andy Clark <an...@apache.org>.
Reza Bagherian wrote:
> please do let me know, If you have any tips on SAX to accomplish
> the goal.
It might be of use to you to know that you can register different
DocumentHandler classes *during* parsing. Therefore, instead of
having a large, complicated startElement/characters/endElement to
handle everything, you can break up the functionality among
several classes.
Is this the kind of tip you're looking for or are you more
interested in tools that perform binding from XML into Java (and
possibly back again)?
--
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org
Re: ?? SAX tips ??
Posted by Lydia Aucoin <la...@lucent.com>.
Hi Reza,
It is actually DOM parsing that produces a hierarchical object through which
you navigate using the DOM calls (such as getFirstChild( ), getPreviousSibling(
),
etc.)
If you use a SAX (Simple API for XML) parser that you download, it will make
calls to your implementation of the SAX interface methods. The methods you site
below, {startElement( ~), characters(~), etc.} are SAX parser callback methods.
You are free to implement these SAX methods however you want.
Just wanted to clarify,
Lydia
Reza Bagherian wrote:
> I am writing a java program to parse a document using SAX.
>
> The output of the parsing process is a huge hierarchical java object. I am
> looking for tips in handling large documents with many embeded objects.
> Instead of having a huge startElement(), character(), and endElement
> methods, i am looking for ways to break down based on a more object oriented
> paradigm.
>
> please do let me know, If you have any tips on SAX to accomplish the goal.
>
> Thanks, Reza