On Mon, Mar 16, 2009 at 8:51 PM, Jeremy Mawson <[email protected]
> wrote:

> Thanks Marc.  <xml:group> works nicely.
>
> For this exercise this is hypothetical, but it matches very closely a
> project I have enabled in the past using struts and JIBX...
>
> Say the data was sourced from an external party's service and there was a
> contractual agreement to not alter the data in any way? I.E. I'm stuck with
> the poorly formed HTML. Probably one could agree with the partner that the
> transformation to valid XHTML is appropriate, but I'll let the question
> stand anyway.
>
> Is poorly formed (but otherwise supported-by-browsers) HTML renderable via
> Lift at all?


If it's supported by the browser, it will be rendered, but Firefox and
Chrome will both complain about malformed XHTML.

You could run the String through an HTML parser (there are a few floating
around for Java that will parse poorly formed HTML) and then walk the nodes
and build XML.  I would argue that this would satisfy any contractual
requirements, although I no longer practice law, so I can't argue it on your
behalf. :-)


>
>
> Cheers
> Jeremy
>
>
>
> 2009/3/17 Marc Boschma <[email protected]<marc%[email protected]>
> >
>
>>
>> On 17/03/2009, at 12:36 PM, Jeremy Mawson wrote:
>>
>> If I change the line to "description" ->  *
>> <span>{Unparsed(result.description)}</span>*, it compiles but I have an
>> unwanted span tag and worse ... if result.description is not well formed XML
>> my page will fail to render! Firefox complains of an XML Parsing Error. The
>> description field has an unmatched <br> tag (literally &lt;br&gt;) in the
>> middle of it to force it onto two lines.
>>
>>
>> Try "description" -> <xml:group>{Unparsed(result.description)}</xml:group>
>>
>> That wraps the string in a scala XML group node...
>>
>> With respect to the <br> tag, it should be <br/> or <br></br> to be well
>> formed. If you want to support non-well formed XML fro the database wouldn't
>> you need to parse it and convert it to well formed first or upon retrieval ?
>>
>> Regards,
>>
>> Marc
>>
>>
>>
>>
>
>
> --
> Jeremy Mawson
> Senior Developer | Online Directories
>
> Sensis Pty Ltd
> 222 Lonsdale St
> Melbourne 3000
> E: [email protected]
>
>
> >
>


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

--~--~---------~--~----~------------~-------~--~----~
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