Hello.<div><br><div>I have some XML elements which text is not plain, but contains some HTML tags.</div><div>The thing is that when outputting these to an XML file the characters "<" and ">" are changed into "&lt;" and "&gt;" preventing its correct posterior HTML processing.</div>
<div>I tried using this EscapeStrategy:</div><div><br></div><div>------------------</div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>class EscapeSimbolos implements EscapeStrategy {</div><div><br>
</div><div><span class="Apple-tab-span" style="white-space:pre">          </span>public boolean shouldEscape(char car) {</div><div><span class="Apple-tab-span" style="white-space:pre">                      </span>switch (car) {</div><div><span class="Apple-tab-span" style="white-space:pre">                       </span>case '<':</div>
<div><span class="Apple-tab-span" style="white-space:pre">                              </span>return false;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>case '>':</div><div><span class="Apple-tab-span" style="white-space:pre">                         </span>return false;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                      </span>default:</div><div><span class="Apple-tab-span" style="white-space:pre">                             </span>return false;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">              </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>}</div></div><div>------------------</div><div><br></div><div>but with no effect. The code within the two case statements is never reached, but the method is executed, so it seems that these characters are converted before the EscapeStrategy gets into action, or maybe I am doing something wrong.</div>
<div><br></div><div>This is the code to set the format:</div><div><br></div><div>---------------------</div><div><div><span class="Apple-tab-span" style="white-space:pre">   </span>Format formato = Format.getPrettyFormat();</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>formato.setTextMode(TextMode.PRESERVE);</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>formato.setEscapeStrategy(new EscapeSimbolos());</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>formato.setIgnoreTrAXEscapingPIs(true);</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>XMLOutputter outputter = new XMLOutputter(formato);</div>
</div><div>---------------------</div><div><br></div><div>I tried setting setIgnoreTrAXEscapingPIs to false, because I am not sure what this does exactly, but nothing seems to change.</div><div><br></div><div>Any ideas?</div>
</div>