Skip to content Skip to sidebar Skip to footer

Spécial HTML Character ( & # 39; -> Quot ) In XML File

I got an ' & # 39; ' in my XML file. (it is the char code for the quot in HTML) EX : < desc > blabla bla & # 39; bla bla la. < / desc> When i parse it with St

Solution 1:

You say that the text is HTML encoded so try this:

String fixedTmp = Html.fromHtml(tmp).toString();

Solution 2:

The best solution i've found was to replace bad char

xmlString = xmlString.replaceAll(" & #39;", " \ ' ");

Solution 3:

I assume you're parsing the XML file with a SAXParser? In this case, note that the 'characters()'-method can be called multiple times while parsing a single Element (as it does in your case). Try this:

private StringBuilder temp_val;
public void characters(char[] ch, int start, int length){
    temp_val.append(ch, start, length);
}

Post a Comment for "Spécial HTML Character ( & # 39; -> Quot ) In XML File"