将xml数据放入script标签中可以在不转码的情况下放入html中。这样就能简单的向XDOC传递XML格式的XDATA数据。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="http://www.xdocin.com/xdoc.js"></script>
</head>
<body>
<script id="xdata" type="text/xdata">
<rss version="2.0">
<channel>
<title>新闻国内</title>
<image>
<title>新闻国内</title>
<link>http://news.qq.com</link>
<url>http://mat1.qq.com/news/rss/logo_news.gif</url>
</image>
<description>新闻国内</description>
<link>http://news.qq.com/china_index.shtml</link>
<copyright>Copyright 1998 - 2005 TENCENT Inc. All Rights Reserved</copyright>
<language>zh-cn</language>
<generator>www.qq.com</generator>
<item>
<title>丽水男子发现滑坡迹象第一个报警 劝走4户邻居</title>
<link>http://news.qq.com/a/20151114/035721.htm</link>
<author>www.qq.com</author>
<category/>
<pubDate>2015-11-14 21:58:00</pubDate>
<comments/>
<description>小李发现滑坡迹象后,第一时间拨打了110和119电话报警。浙江在线丽水11月14日讯(浙江在线记者/胡昊编辑/沈正玺)11月13日22点50分许,丽水市莲都区雅溪镇里东村发生山体滑坡。</description>
</item>
<item>
<title>巴黎黑色星期五 防暴恐看看国家为我们做了什么</title>
<link>http://news.qq.com/a/20151114/034859.htm</link>
<author>www.qq.com</author>
<category/>
<pubDate>2015-11-14 21:23:45</pubDate>
<comments/>
<description>今天一早,长安君和大家一样就看到了震惊世界的头条:13日晚,法国巴黎市中心发生多起暴恐分子枪击、爆炸事件,伤亡已超过百人,法国政府已宣布全国进入紧急状态。</description>
</item>
</channel>
</rss>
</script>
<script type="text/javascript">
XDoc.run("./rss.xdoc", "pdf", {_xdata:document.getElementById("xdata").innerHTML});
</script>
</body>
</html>