现在的位置: 首页 > 综合 > 正文

DTD学习

2013年12月08日 ⁄ 综合 ⁄ 共 773字 ⁄ 字号 评论关闭

1 看下xml的错误的配置 from多了一个m

<?xml version="1.0"?>
<!DOCTYPE note [
  <!ELEMENT note    (to,from,heading,body)>
  <!ELEMENT to      (#PCDATA)>
  <!ELEMENT from    (#PCDATA)>
  <!ELEMENT heading (#PCDATA)>
  <!ELEMENT body    (#PCDATA)>
]>
<note>
<to>Tove</to>
<fromm>Jani</fromm>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note> 

2 验证代码

<html>
<body>
<h3>
This demonstrates a parser error:
</h3>
<script type="text/javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.validateOnParse="true"
xmlDoc.load("err.xml")
document.write("<br />Error Code: ")
document.write(xmlDoc.parseError.errorCode)
document.write("<br />Error Reason: ")
document.write(xmlDoc.parseError.reason)
document.write("<br />Error Line: ")
document.write(xmlDoc.parseError.line)
</script>
</body>
</html>

3 用ie打开,搜狗看不出来

4 提示11行有错 ,11行的确有问题

抱歉!评论已关闭.