Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [solved] xtend helper to escapeHTML(string)(is there a helper in XTEND to convert a string to an HTML-one?)
[solved] xtend helper to escapeHTML(string) [message #1722269] Wed, 03 February 2016 16:39 Go to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Working on that "Survey" example.

If the user enters some special characters as a title string,
they may have to be escaped before I can write it into my HTML file.

Is there some helper to do this in the generator?

[Updated on: Wed, 03 February 2016 17:25]

Report message to a moderator

Re: xtend helper to escapeHTML(string) [message #1722271 is a reply to message #1722269] Wed, 03 February 2016 16:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi we use commons langs StringEdcapeUtils for that

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtend helper to escapeHTML(string) [message #1722273 is a reply to message #1722271] Wed, 03 February 2016 17:08 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Tried your hint with some example from the web:

import org.apache.commons.lang.StringEscapeUtils;
String results = StringEscapeUtils.escapeHtml("gjhkj>-");

when I try to enter in my SurveyGenerator.extend:

import org.apache.commons.lang.StringEscapeUtils;

I get an error that this can not be resolved to a type.
and therefore the following code fails as well:

def test1 () {
val escaped = StringEscapeUtils.escapeHtml("abc");
}


Is there something I overlooked?
TIA, Uli
Re: xtend helper to escapeHTML(string) [message #1722274 is a reply to message #1722273] Wed, 03 February 2016 17:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Die you add a required bundle or a import package to the manifest

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtend helper to escapeHTML(string) [message #1722275 is a reply to message #1722274] Wed, 03 February 2016 17:24 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Hi Christian,

thanks for this other hint.
It works now (just overlooked to add it to the dependecies)

[Updated on: Wed, 03 February 2016 17:25]

Report message to a moderator

Previous Topic:Understand Build
Next Topic:Accessing properties... the right way!
Goto Forum:
  


Current Time: Thu Apr 25 19:21:20 GMT 2024

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

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

Back to the top