XML within an Android string resource?

Yes you can, just use CDATA

<string name="stringName1"><![CDATA[<html>bla</html>]]></string>


It will obviously not work unless you escape characters in there such as < or > or &.

If you do encode the XML, it should work fine but probably not the best way to do it. I would prefer binary resource.


For putting in string.xml, you may encode using

String encoded = URLEncoder.encode(xml);

And decoding is the opposite.

For binary, you place it in RAW folder and you get a binary stream and turn it to string and load.