I am writing some code to send an XML document to a Servlet. For one of the XML tag fields, I need to fill it with a string that is retrieved from an external file.
I have found a couple of external files that contain some < and > characters. The servlet will not accept this XML document in this case.
If I remove the < and > characters from the XML tag field, the XML document is sent correctly.
As I am going to be using 1000s of external files, I am sure there will be other occurances of "illegal" characters. Is there an XML encode or similar function that can be used to format a string such that it can be stored in an XML tag with no errors?
I have tried HTML encode, but this does not work. Is there an equivilent action for XML?