Added bit so it doesn't stop if the xap or appx file is not created,
instead it will log the fact and continue.  Also move all the search and
replace code (except for one piece) into a single function and added
html_encoding so it escape XML unsafe characters properly.