呈现 XML 的 nbsp 问题
这是我的 Xml 格式
<P style="TEXT-ALIGN: center; MARGIN: 0pt">
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; FONT-WEIGHT: bold">Washington,</SPAN>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; FONT-WEIGHT: bold">D.C. 20549</SPAN>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 18pt; FONT-WEIGHT: bold"> </SPAN>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt">
</SPAN>
广告,我通过 XSLT 文件渲染它来打印它,但在解析我用 google 搜索的
时抛出错误
..有多种方法可以编辑 XSLT执行此操作,但是是否有任何代码片段可以在 JS 中用于此目的,因为我的 XML 没有固定其动态,并且我认为在每个 XML 文件中添加这些行是一项艰巨的任务。
我的剧本
<script type="text/javascript">
function load_xml_content_string()
{
xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.async = false;
xmldoc.load("book.xml");
xsldoc = new ActiveXObject("Microsoft.XMLDOM");
xsldoc.async = false;
xsldoc.load("try.xsl");
ex= xmldoc.transformNode(xsldoc);
document.getElementById('mytext').innerHTML = ex;
}
</SCRIPT>
this is my Xml format
<P style="TEXT-ALIGN: center; MARGIN: 0pt">
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; FONT-WEIGHT: bold">Washington,</SPAN>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; FONT-WEIGHT: bold">D.C. 20549</SPAN>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 18pt; FONT-WEIGHT: bold"> </SPAN>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt">
</SPAN>
ad i am rendring it through the the XSLT file to print it but its throwing a error while parsing the
i googled..there are various ways which edit's the XSLT to do this but is there any code snippet which can be used in the JS
for this purpose because my XML is not fixed its dynamic and i think its a difficult task to add those lines in every XML file.
my script
<script type="text/javascript">
function load_xml_content_string()
{
xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.async = false;
xmldoc.load("book.xml");
xsldoc = new ActiveXObject("Microsoft.XMLDOM");
xsldoc.async = false;
xsldoc.load("try.xsl");
ex= xmldoc.transformNode(xsldoc);
document.getElementById('mytext').innerHTML = ex;
}
</SCRIPT>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 XML 应该有 DTD 声明
,因为现在您的 XML 不是格式良好的 XML 文档:
Your XML should have DTD declaring the
, because now your XML isn't a well-formed XML document: