Solved by coworker:
private def handleMarkup(xml: Node): Node = {
(xml map {
case Elem(prefix, "markup", attributes, scope, children @ _*) =>
{
Utility.trim(Elem(prefix, "markup", attributes, scope,
Text(children.foldLeft("")(_ + _.toString
}
case Elem(prefix, label, attributes, scope, children @ _*) => {
Elem(prefix, label, attributes, scope,
children.map(handleMarkup(_)) : _*)
}
case x => x
}).first
}
On Feb 11, 1:51 pm, Mike wrote:
> Looking for some advise about encoding raw HTML to JSON.
>
> Here as some sample XML similar to what we are using:
> 846
> Mike
>
>
> testing
>
>
>
> When converting this XML to JSON I would like the "markup" element and
> all of it's children to be returned as a big string. For example:
> {"id": 846, "name": "Mike", "markup", "testing"}
>
> Right now it always tries to parse the children, resulting in
> something similar to:
> {"id": 846, "name": "Mike", "markup":{"div":{"h1":"testing"}}
>
> Any insights?
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.