Monday, December 13, 2004

SAX Parser Problem (Very Odd)

While implementing a simple SAX parser for Open Financial eXchange, a XML scheme in which my bank provides account statements I found the following problem with the parser:

Some of the transaction amounts read from the XML file got truncated. For example, when the parser reads the following XML fragment:
<trnamt>1770.28</trnamt>
it would truncate the value to 177 and you would have 177$ instead of 1770.28$. Very odd :-(

Later, I found the above problem in forum.java.sun.com

The solution can be found (as usually) in the documentation for the characters() method of org.xml.sax.ContentHandler. Did you read it? :-)

"SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks..."

So, here comes my code, AbstractOFXHandler.java and documentation.

0 Comments:

Post a Comment

<< Home