This is a simple function used to encode text and attribute values before adding them to your XML documents. This code can always be extended to handle more special characters. Code: JSP 1.1
To use the code above, click and drag your mouse over the code to highlight it. Then right click on the highlighted code and click "Copy." Now you may paste it into your code editor.