"The entity name must immediately follow the ‘&’ in the entity reference"
you may filter the string, which you want to convert to xml document, with the following code.
private String xmlFixer(String xmlString) {
xmlString = xmlString.replaceAll("&([^; ]*);", "||VALIDXMLTAG||$1;");
xmlString = xmlString.replaceAll("&","&");
xmlString = xmlString.replaceAll("\\|\\|VALIDXMLTAG\\|\\|([^; ]*);", "&$1;");
return (xmlString);
}

0 comments:
Post a Comment