From: <wol...@ex...> - 2014-08-20 12:47:43
|
> This is what I wanted to do - but can’t find simple methods of adding those content types to the XML result: It’s hard to say without trying it out myself, but I would suggest the following: wrap a DocumentBuilderReceiver around your builder: DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder); When you call ModuleUtils.htmlToXHtml, keep the returned DocumentImpl: DocumentImpl htmlDoc = ModuleUtils.htmlToXHtml(context, "alternative", new StreamSource(bp.getInputStream()), null, null); and stream it to the receiver: ElementImpl rootElem = (ElementImpl)htmlDoc.getDocumentElement(); htmlDoc.copyTo(rootElem, receiver); Hope this works. Wolfgang |