Java Sax Parser does not recognize < and > [duplicate]
Possible Duplicate:
SAXParser '&&开发者_StackOverflow中文版#39; concatenation problem
I wrote a small Sax Parser in Java. In my file, I have some <
and >
escaped chars.
However, instead of giving me <
and >
, the parser just stops for the chars when these sequences are met.
I mean, if I parse: "aaa < bbb"
, I'll get "aaa"
.
Thanks in advance for your help :).
Firstly, I don't think you wrote a SAX parser. I think you wrote a SAX ContentHandler. Saying you wrote a parser is like saying you're a baker because you bought a loaf of bread this morning.
Secondly: read the spec. In SAX, the parser is allowed to supply the content of text nodes in as many calls to characters() as it likes. It's the job of the ContentHandler to assemble them. Many parsers choose to break the text at natural boundaries like the start and end of entity and character references, because that reduces the need for copying of character arrays.
精彩评论