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?
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.
Joined: Dec 17, 2008
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?
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.