package fr.insee.rmes.utils;

public class XmlUtils {
	
	public static String encodeXml(String s) {
		 return s.replaceAll("&lt;([a-zA-Z]+)&gt;", "<$1>") //xml open tag
				 .replaceAll("&lt;/([a-zA-Z]+)&gt;", "</$1>") //xml close tag
				 .replaceAll("&lt;([a-zA-Z]+)/&gt;", "<$1/>") //br
				 .replaceAll("&lt;([a-zA-Z]+) /&gt;", "<$1 />") //br with space
				 .replaceAll("&lt;a href=&quot;(.*?)&quot;&gt;", "<a href=\"$1\"> />"); //a href open tag
	}

}

@@ -158,24 +158,139 @@
 ml open tag%0A
+%09%09%09%09 .replaceAll(%22&lt;(%5Ba-zA-Z%5D+) style=(&quot;%7C')(.*?)(&quot;%7C')&gt;%22, %22%3C$1 style=%5C%22$3%5C%22%3E%22) //open tag with style%0A
 %09%09%09%09 .replac
@@ -499,25 +499,33 @@
 ref=
+(
 &quot;
+%7C')
 (.*?)
+(
 &quot;
+%7C')
 &gt;
@@ -543,15 +543,307 @@
 =%5C%22$
-1
+2
 %5C%22%3E 
-/%3E
+%22) //a href open tag%0A%09%09%09%09 .replaceAll(%22&lt;a title=(&quot;%7C')(.*?)(&quot;%7C') href=(&quot;%7C')(.*?)(&quot;%7C')&gt;%22, %22%3Ca title=%5C%22$2%5C%22 href=%5C%22$5%5C%22%3E %22) //a title href open tag%0A%09%09 %09%09.replaceAll(%22&lt;a href=(&quot;%7C')(.*?)(&quot;%7C') title=(&quot;%7C')(.*?)(&quot;%7C')&gt;%22, %22%3Ca title=%5C%22$5%5C%22 href=%5C%22$2%5C%22%3E 
 %22); 
@@ -843,31 +843,37 @@
 %22%3E %22); //a href 
+title 
 open tag%0A%09%7D%0A%0A%7D%0A
@@ -866,14 +866,15 @@
 pen tag%0A
+%0A
 %09%7D%0A%0A%7D%0A

Add tag with style and improve linktag for xml encoder