I have been using SimpleXML for a while now to serialize my java objects, but I am still learning and run into trouble sometimes. I have the following XML that I want to deserialize:
<messages>
<message>
<text>
A communications error has occurred. Please try again, or contact <a href="someURL">administrator</a>. Alternatively, please <a href = "someURL' />">register</a>.
</text>
</message>
I would like process it such that the contents of the element are treated as a single string and the anchor tags to be ignored. I have no control on how this XML is generated - it is, as you can see, an error message from some server. How do I achieve this? Many thanks in advance.
You might want to try escaping the text by importing:
import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
And using it as:
a.setWordCloudStringToDisplay(escapeHtml(wordcloud));