Ah, I see. How are you serving this XML response? If you're running it through Lift's standard
rendering pipeline, then you'll be in a situation where the XML is being read from the filesystem
using the HTML5 parser. In HTML5, source is a
valid element, but an empty one, so the HTML5
parser will throw out any contents it may have (sometimes these will become siblings, but an
XML document can only have one root, so that'll probably affect the results).
If I'm right about this, that means we need to fix the cookbook to indicate that you must use the
XML reader in these cases. You can do this by doing something like:
LiftRules.htmlProperties.default.set({ request: Req =>
if (request.path.suffix == "xml") {
OldHtmlProperties(request.userAgent)
} else {
Html5Properties(request.userAgent)
}
})
This will use the XHTML reader and writer, which don't handle HTML validation or failure modes.
An even better alternative would be to use the XML reader directly, but I'm not 100% sure exactly
what that would look like at the moment. Richard, if I'm right about this, I guess we'd need to update
the cookbook…
Thanks,
Antonio