How can I keep my doctype with htmlunit + the page.asXml method
When I run page.asXml() with HtmlUnit I l开发者_高级运维ose my page's doctype. Is there a work around?
Note: the intent is to serve up DOM for Google.
Try calling
p.getWebResponse().getContentAsString()
instead of
p.asXml()
I just tried it against http://google.com, and in the former case "<!doctype html>" remained in the output.
精彩评论