xml:xml是可扩展的标记性语言,它主要是用来存储数据,被喻为:小型数据库
它不存在预定义标记,全部都是要自定义的标记
优点:准确性高
说html和xml的区别:
xml:就是用来传送和存储数据
html:就会显示数据
在同一个文件中
不在同一个文件
DTD文件中
xml文件中
它不存在预定义标记,全部都是要自定义的标记
优点:准确性高
说html和xml的区别:
xml:就是用来传送和存储数据
html:就会显示数据
在同一个文件中
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE school [
<!ELEMENT school (grade?,weclome*,filter+)>
<!ELEMENT grade (class)>
<!ELEMENT class (student+)>
<!ELEMENT student (#PCDATA)>
<!ATTLIST school name CDATA #FIXED "可爱的学校"
address CDATA #IMPLIED
>
<!ATTLIST student no ID #IMPLIED
sex (男|女) "女"
name CDATA #REQUIRED
>
<!ENTITY SCHOOLNAME "可爱的学校">
]>
<school name="可爱的学校">
<grade>
<class>
<student no="A1000" sex="男" name=""可爱的学校"">&SCHOOLNAME;</student>
<student no="A1001" sex="女? name="乖乖"></student>
</class>
</grade>
<filter>
</filter>
</school>
不在同一个文件
DTD文件中
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT webapp (global,package+)>
<!ELEMENT global (result)>
<!ELEMENT package (action+)>
<!ELEMENT action (result)>
<!ELEMENT result (#PCDATA)>
<!ATTLIST package name CDATA #REQUIRED
namespace CDATA #REQUIRED
>
<!ATTLIST action name CDATA #REQUIRED
type CDATA #REQUIRED
method CDATA #REQUIRED
>
<!ATTLIST result name CDATA #REQUIRED
path CDATA #REQUIRED
redirect (true|false) "false"
>
xml文件中
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE webapp SYSTEM "action.dtd">
<webapp>
<global>
<result name="error" path="error.jsp" redirect="true"></result>
</global>
<package name="student" namespace="/student">
<action name="StudentAction" type="com.lxit.ext.student.action" method="getStudent">
<result name="success" path="success.jsp"></result>
</action>
<action name="StudentAction" type="com.lxit.ext.student.action" method="update">
<result name="success" path="success.jsp"></result>
</action>
</package>
<package name="classes" namespace="/classes">
<action name="ClassesAction" type="com.lxit.ext.classes.action" method="getClasses">
<result name="success" path="success.jsp"></result>
</action>
<action name="ClassesAction" type="com.lxit.ext.classes.action" method="update">
<result name="success" path="success.jsp"></result>
</action>
</package>
</webapp>