Stupid question I'm sure..however, what does ContentHandler return? I have
my main class that starts the parsing, then a custom content handler class
that implements ContentHandler. However, in my main class I'm not sure what
I can use that's returned in ContentHandler. What I did in my ContentHandler
was create a StringBuffer of data...I need that StringBuffer to available in
the main class

Hope this makes sense and thanks in advance for the patience with the
newbie.

-Brent

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 19, 2002 6:53 PM
To: [EMAIL PROTECTED]
Subject: Re: Help!!


you need to write a class which extends DefaultHandler .. then over ride the
relevant methods to save your data to the hash table

so if your xml is like

<element1>
    blah blah
</element1>

then you over ride the methods

    characters(char[] ch, int start, int length)
    and put the charecters that you are getting in a StringBuffer.

and override

    endElement(java.lang.String uri, java.lang.String localName,
java.lang.String qName)
    and put the data from the String buffer in the hashtable and create a
new
    StringBuffer... there is no way to clear the String buffer

and remember to make the string buffer an instance variable so that
it is accessible to both the methods

hope it helps

anshuman


Brent Scott wrote:

> Newbie to Java and probably in way over my head, but I need to finish this
> project or I'll go crazy :)
>
> I'm trying to create a SAX driven parser using Xerces. I chose SAX over
DOM
> for minimal memory usage. What I'm not sure how to do is put the results
in
> a Hashtable. It's important that I be able to do this so I can later call
> the results of the Hashtable.
>
> Is this something that is possible? I've seen one way it's done with DOM
but
> the way DOM parses and the way SAX does seem seemingly different.
>
> If someone could help me or at least point me in the right direction I
would
> be most appreciative. I am more than willing to send current code to
willing
> participant.
>
> Thank you Group!!
>
> ~Cheers, Brent


Reply via email to