parsing XML files with SAX



hi,

I've been looking through the various XML parsers API available and I have
decided to use the SAX parser. Probably not the best of choices but I think
it can do the job. What is the best way to parse an XML file using the SAX
parser ? I have seen examples where they store each element tag in java bean
classes. I am not sure this is a good way for my XML file which looks like
this:

<parent>
<node1>
<child1>AAA</child1>
<grandchild1>BBB</grandchild1>
<grandchild2>
<anything>CCC</anything>
</grandchild2>
<child2>DDD<</child2>
<child3>DDD<</child3>
</node1>
<node2>
<child1>AAA<</child1>
<grandchild1>BBB</grandchild1>
<grandchild2>
<anything>CCC</anything>
</grandchild2>
<child2>DDD<</child2>
<child3>DDD<</child3>
</node2>
</parent>

I have to get the value of the tag "anything" in node1, node2 etc ..., store
the value of child3 in a database etc ...

Does anyone have any experience or advices regarding the fastest way to do
that using SAX (or any other parser) ?

Thanks !


.



Relevant Pages

  • Re: torture
    ... If you're using Java 1.4 then you already have an XML parser built in to ... manipulable object representation of the XML document in memory. ... The SAX API works by reading the document and generating callbacks to ...
    (comp.lang.java.programmer)
  • Re: XML Parser in EVC++ 4.0
    ... Excuse me can you give me some example for read my file XML with SAX ... parser in EVC++? ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: XmlTextreader versus DOM
    ... I've heard them referred to as "DOM" and "SAX". ... DOM is, generally speaking, the easiest way in which to deal with XML ... "SAX" (named after the original parser, I think) parsers read one XML ...
    (microsoft.public.dotnet.xml)
  • Re: [PHP] Good XML Parser
    ... So if I'm looking to parse certain attributes out of an XML tree, ... XML parsers fall into two general camps - DOM and SAX. ... If you just need the data, a SAX parser will probably do everything ...
    (php.general)
  • Re: XmlTextreader versus DOM
    ... I've heard them referred to as "DOM" and "SAX". ... DOM is, generally speaking, the easiest way in which to deal with XML ... "SAX" (named after the original parser, I think) parsers read one XML ...
    (microsoft.public.dotnet.languages.vc)