aspose file tools*
The moose likes XML and Related Technologies and the fly likes I do not know in which part of SAX Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "I do not know in which part of SAX Class" Watch "I do not know in which part of SAX Class" New topic
Author

I do not know in which part of SAX Class

Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 403
I am trying use SAX (java class) and an XML Doc to write xml data to database, well I do not know in which part of SAX Class, use the database conn, stm and execute query, statements??? can you help?

Also is it required use, ArrayList or Array or a collection?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

There aren't any rules which say you always have to put the JDBC code in a particular part of your code. That's not how programming works. It's up to you to write the program and put the code in the correct places. (Where "correct" means "whatever works for your requirements".)

And likewise, no, you aren't required to use an ArrayList or any other collection in any code you write.

If you have a specific question, you should ask that specific question here. It seems like you don't know where to go with this SAX program you want to write. So how about if you produce some code, then explain your requirements and ask what to do with that code?
Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 403
For the particular sax refered I wrote code that prints correctly in output the query statement, but when I tried actual query , in another try this does not written in local db...

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Leonidas Savvides wrote:For the particular sax refered I wrote code that prints correctly in output the query statement, but when I tried actual query , in another try this does not written in local db...


I see. Then what you should do is to write a small piece of code which does nothing but update a record in a database. Once you have that code working, put a copy of it in your SAX program and adapt it to use the data from SAX. Trying to use two hundred lines of code to debug a database interaction, when most of them have nothing to do with the database, is doing things the hard way.

And here's a hint: your code has a catch-clause which looks like this:

If the code above that throws an exception, then you won't know that. Because the catch clause does nothing. This is not a good way to debug your code. At least print the exceptions so you know when they happen and what went wrong. Like this:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I do not know in which part of SAX Class