0

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

2
  • please show your tried code to get help Commented 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. Commented Jan 15, 2013 at 3:57

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

+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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.