开发者

How can I keep my doctype with htmlunit + the page.asXml method

开发者 https://www.devze.com 2023-01-27 12:17 出处:网络
When I run page.asXml() with HtmlUnit I l开发者_高级运维ose my page\'s doctype.Is there a work around?

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

精彩评论

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