开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜