1.xml可扩展标记语言(Extensible Makeup Language)
<?xml version="1.0" ?>
<?xml version="1.0" encoding="GB2312" ?>
<?xml version="1.0" encoding="GB2312" standalone="yes" ?>
格式良好的XML文档必须有且仅有一个根标签,其它标签都是这个根标签的子孙标签
<![CDATA[
<itcast>
<br/>
</itcast>
]]>
3.
文件清单:book.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE books SYSTEM "book.dtd"> <books> <book> <name>Java Thinking</name> <author>Bruce</author> <price>68</price> </book> <book> <name>Java Core</name> <author>Gray</author> <price>79</price> </book> </books>
文件清单:book.dtd
文件清单:book.dtd <!ELEMENT books (book+)> <!ELEMENT book (name,author,price)> <!ELEMENT name (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT price (#PCDATA)>
验证XML文档的范例代码1(会用)
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript"> function initXml(){ var xmldoc = new ActiveXObject("Microsoft.XMLDOM"); xmldoc.validateOnParse = "true"; /**********修改成自己的xml文件*****************/ xmldoc.load("book.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> </head> <body onload="initXml();"> </body> </html>
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN“
"http://java.sun.co.m/dtd/web-app_2_3.dtd">
4.实体(相当于变量)
原文:http://www.cnblogs.com/fanglove/p/3857325.html