| Author |
sql query stored in the xml, parsed and executed from java - throws malformed exception
|
az ziz
Ranch Hand
Joined: Dec 17, 2008
Posts: 50
|
|
dear all,
I store the sql queries like stored proc call query, other queries in an xml, i use this xml to parse an execute appropriate query. I have written dtd for it. assume xml element is like this
in dtd i have given stored-procedure (#PCDATA)
If i include the dtd file in xml and parse the xml the java code and execute the query jdbc throws Malformed SQL92 string at position: 34
If i remove the dtd and run the parser and execute the query it works!
I know that the #PCDATA will parse the text between the tag, how do i make it work?
Thanks for your helps
V
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
My guess would be that different strings are being produced as a result of your parsing. If it were my problem I would be interested in seeing how those strings differ from each other.
Actually any time I got an error message saying my SQL string had a problem, my first idea would be to look at that string. I recommend that.
|
 |
az ziz
Ranch Hand
Joined: Dec 17, 2008
Posts: 50
|
|
thanks for you reply Mr. Clapham,
i had checked the query that is sent to the jdbc statement.
I use apache sax parser
the value string extracted comes differently. how does this happen?
I see that the query string has been lost, before or after in the query string. but what bothers me is that if i did not include the dtd file it works fine, no string is lost, no matter how much big or complex the query be.
is this post changing topic from jdbc to xml parsing?
V
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2343
|
|
Is the DTD file correct?
I am moving this thread to our XML and Related Technologies forum. The issue we have here is not related to sql, but to parsing XML.
Regards, Jan
|
OCUP UML fundamental
ITIL foundation
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
You have run into the common misconception about the characters() method.
It does NOT grab all of the characters inside the element reliably. If the text gets split across two buffer-load you get exactly what you are seeing. Including the DTD is changing the way the characters you are interested in fall at buffer boundaries.
Bill
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: sql query stored in the xml, parsed and executed from java - throws malformed exception
|
|
|