Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » (Download-)Links in Table- and TreeViewer
(Download-)Links in Table- and TreeViewer [message #1100629] Tue, 03 September 2013 11:12 Go to next message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
Hi!

I tried to embed links in a TreeViewer, but encountered the following problem.
Embedding links works fine, as long as they do not include '&'. If any part of the html contains an ampersand('&') however, the Viewer can not display the item and an IllegalArgumentExceptino is thrown:

Text:

<a href="/testing?servicehandler=7d880b02docsDLTest5.pdf&cid=de8c4e9&filename=Test5.pdf" >Test5.pdf</a>

Exception:

java.lang.IllegalArgumentException: Failed to parse markup text
<...>
Caused by: org.xml.sax.SAXParseException: The reference to entity "cid" must end with the ';' delimiter.


How can I turn this reference behavior off or escape my html correctly?

Thanks for any advice,
Tibu

[Updated on: Tue, 03 September 2013 11:22]

Report message to a moderator

Re: Links in Table- and TreeViewer [message #1100773 is a reply to message #1100629] Tue, 03 September 2013 15:13 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1872
Registered: July 2009
Senior Member
Hi Tibu,
the MarkupValidator is using javax.xml.parsers.SAXParser internally to
check if markup is correct (valid XHTML). Parsing failed if there is '&'
character as it indicates entity start. Please file a bugzilla about
this issue.
Thanks,
Ivan


On 9/3/2013 2:12 PM, Tiburon T wrote:
> Hi!
>
> I tried to embed links in a TreeViewer, but encountered the following
> problem.
> Embedding links works fine, as long as they do not include '&'. If any
> part of the html contains an ampersand('&') however, the Viewer can
> not display the item and an IllegalArgumentExceptino is thrown:
>
>
> Text:
>
> <a
> href="/testing?servicehandler=7d880b02docsDLTest5.pdf&cid=dd8c3e7&filename=Test5.pdf"
> >Test5.pdf</a>
>
> Exception:
>
> java.lang.IllegalArgumentException: Failed to parse markup text
> <...>
> Caused by: org.xml.sax.SAXParseException: The reference to entity
> "cid" must end with the ';' delimiter.
>
>
> How can I turn this reference behavior off or escape my html correctly?
>
> Thanks for any advice,
> Tibu

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Links in Table- and TreeViewer [message #1100788 is a reply to message #1100773] Tue, 03 September 2013 15:40 Go to previous message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
I created Bug 416451[1]

For the interested:
I managed to work around the issue.
I replaced the ampersands in the original link with %26 and registered a "LinkListener" to the tree, as described in the 2.1 New and Noteworthy[2]. When the listener is activated it takes the URL from the event (event.text), replaces the %26's again and sets the original URL in an invisible Browser-Widget. This triggers the client browser to start the download.

Greetings
Tibu

[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=416451
[2]http://eclipse.org/rap/noteworthy/2.1/

[Updated on: Tue, 03 September 2013 15:41]

Report message to a moderator

Previous Topic:TableViewer column divider click to resize
Next Topic:How to size Composite based on CSS background-image?
Goto Forum:
  


Current Time: Sat Dec 20 18:12:31 GMT 2014

Powered by FUDForum. Page generated in 0.01500 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software