On Tue, Feb 9, 2010 at 12:04 PM, GA <[email protected]> wrote:

> What we have here is a iphone native application that has the help screens
> in HTML. The help screens are in multiple languages and are stored in the
> database.
>
> When the application starts, it checks in the server for updates in the
> help pages calling a particular URL but with different context parameters.
> The downloaded HTML is stored locally in the app to be able to work when the
> phone is offline. The downloaded content has a common template for each
> language and it loads the content from the database.
>
> The help content has been written as HTML in MS Word. It has been already
> formatted there. That is why it is stored altogether in the database. It is
> not a typical lift web site.
>
> If it is not possible to pass the characters unescaped, then we will have
> to create the pages individually loading just the text from the database. It
> is not a big deal and I know it would be cleaner, but I wanted to know if we
> can avoid this change.
>

As Naftoli mentioned, scala.xml.Unparsed(string) will pass string to the
output.  If the string is not valid XML, the client browser may complain.


>
> Thanks in advance,
>
> GA
>
> On Feb 9, 2010, at 8:31 PM, David Pollak wrote:
>
>
>
> On Tue, Feb 9, 2010 at 10:00 AM, GA <[email protected]> wrote:
>
>> Hello guys,
>>
>> I have a very silly question. I have a snippet that reads a string field
>> from the database and it inserts it within a html page.
>>
>> So far so good. The text that the snippet reads from the database is a
>> piece of html code. The problem is that the bind method replaces the "<" and
>> ">" within the string with "&lt;" and "&gt;". The snippet looks like
>> that:
>>
>> if (context != "") {
>>             ContextHelp.findByKey(context.toLong) match {
>>                 case Full(help) => {
>>                         val message = help.contextHelp
>>                         Helpers.bind("b", in, "text" ->  message.toString)
>>                 }
>>                 case _ => Helpers.bind("b", in, "text" -> "Context not
>> found")
>>             }
>>         } else Helpers.bind("b", in, "text" -> "The URL is invalid. ")
>>
>>
>> The HTML that calls the snippet looks like this:
>>
>> <lift:LoadHelp.getHelp>
>> <b:text/>
>> </lift:LoadHelp.getHelp>
>>
>> What should I do to get the html content without changes in the tags?
>>
>
> It is not Helpers.bind() that's transforming the text.  It's the XML
> libraries that properly XML escape Text() elements when they are converted
> from XML representation to a byte stream.
>
> In almost every context, this is what you want... you want Strings to be
> properly escaped.  If that was not the case, there would be tons of cross
> site scripting issues.
>
> So, what is the type of "message" in the code above?  Do you really,
> really, really mean for the String representation of message to be not XML
> escaped?
>
>
>>
>> Thanks in advance,
>>
>> GA
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<liftweb%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/liftweb?hl=en.
>>
>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<liftweb%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to