I am trying to parse xml file which contains some special character if (($a > 7)) I am using StringBuffer to read these characters but its not reading the whole string. All the characters after > has been chopped off. All its returning me is if(($a. Please suggest me.
Thanks
-
please show your tried code to get helpvishal_aim– vishal_aim2013-01-15 03:51:34 +00:00Commented Jan 15, 2013 at 3:51
-
Yes proper way to escape Entities References like >,< and other reserved key word is to use CDATA but i am trying to read xml file of third party so there is no point of me adding CDATA to the file. I have to solve the issue without the use of CDATA. Any suggestion. And i have to use SAX not DOM because of memory issue. Working fine with DOm parser but I am getting memory issue so I thought of using SAX.JavaGuy– JavaGuy2013-01-15 03:57:35 +00:00Commented Jan 15, 2013 at 3:57
Add a comment
|
1 Answer
When you parse XML with SAX, you can get the text of an element in multiple method calls. you must accumulate the text across all the calls until you get the endElement call.
1 Comment
Jim Garrison
+1 This is a pitfall commonly overlooked. The parser is free to give you text in as many pieces as it wants to, which you must concatenate.