Skip to main content

Passing variable from contentHandler

1 reply [Last post]
rojer2000
Offline
Joined: 2007-06-15
Points: 0

Hey all,

I have a little problem with Jaxp (xerces). I don't know though if it is a java or jaxp related problem. Anyway, I have implemented the contentHandler to handle callback methods. My problem is that I cannot find a way to pass a variable to the class that instantiates the parser (this class is named ParseXML). In particular, I have collected some data from the xml I am parsing, and stored them to an arraylist. How can I pass the arraylist to the ParseXML class instance or in the main class? If I declare a get method inside the contentHandler and declare in ParseXML, data = contentHandler.getData(); it says that the method is undefined. Is there any other way I can do this?

As you may have quessed I'm pretty new in Java, so any help would be greatly appreciated.

Thank you.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
spericas
Offline
Joined: 2003-06-10
Points: 0

rojer2000,

Your question seems to be related to Java and not JAXP. I suspect that your variable 'contentHandler' is of type ContentHandler rather than the type of the class you defined (which extends ContentHandler). Posting some code may help.