On Friday 05 March 2010 04:58:57 Sergiu Dumitriu wrote:
> I need to use getXMLEncoded because the title doesn't always come from 
> the content.

I saw the suggestion to modify the getXMLEncoded route on the JIRA ticket, so 
I decided to do some testing with that. I only know two ways to set the title 
for a document (are there more?) either from the content or the title, and 
here's the results from those. (I have edited the out some hrefs="")

Case 1: Having a document where title field is blank, but having a section as
Document 1: = A damn <hr /> ruler =
Document 2: = Att-göra-lista =

Results: 
$rdoc.displayTitle  
1             <a>A damn &lt;hr /&gt; ruler</a>
2             <a>Att g&#246;ra-lista</a>


$xwiki.getXMLEncoded($rdoc.getRenderedTitle('plain/1.0')
1             <a>A damn &#60;hr /&#62; ruler</a>
2             <a>Att göra-lista</a>
 
Visually: all the results appears okay and the same in Firefox. (I wonder if 
IE versions can handle the XML output?) The xml route outputs UTF-8 
characters, whereas displayTitle escapes them correctly even if the browser 
selects wrong character encoding. However, the rest of the wiki use utf-8 
consistently so that later case is not likely an issue.


Case 2: Putting the same in proper title field.

Results:
$rdoc.displayTitle
1              <a>= A damn </a><hr/><a> ruler =</a>
2              <a>= Att göra-lista =</a>

$xwiki.getXMLEncoded($rdoc.getRenderedTitle('plain/1.0')
1              <a>= A damn</a><p><a></a></p><hr/><a></a><p><a>ruler =</a></p>   
  
2              <a>= Att göra-lista =</a>

Visually: As you see, the characters are not escaped at all when using the 
title, no matter what method is being used. Guessing would make me say the 
title field is buggy. The xml route even puts in a few extra <p> tags for some 
reason.


I think the proper title field needs to be fixed in some way to escape special 
characters before this can be fixed. It might also be good to have an example 
where getXMLEncoded() does any good for panel links at the moment, for testing 
purposes?

-Regards, Joel
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to