关于dtd就不多介绍
以下是个实例,包含绝大多情况
<?xml version="1.0" encoding="UTF-8"?>
<!-- 被2012 () 使用XMLSpy v编辑的 (http://www.altova.com) by -->
<!--数据访问根节点-->
<!ELEMENT DataAccessLayer (mapper+)>
<!--数据映射,包含需要映射表、结果集与增删改查语句。-->
<!ELEMENT mapper (Methods+, table+, resultMap+, select+, update+, delete+, insert+)+>
<!ATTLIST mapper
namespace ID #IMPLIED
>
<!--数据源表-->
<!ELEMENT table (column+)+>
<!ATTLIST table
id ID #REQUIRED
jdbcTableName CDATA #REQUIRED
>
<!--数据列-->
<!ELEMENT column (many-to-one*, one-to-many*)+>
<!ATTLIST column
name ID #REQUIRED
type (date | timestamp | string | boolean | decimal) #FIXED "date"
length CDATA #REQUIRED
jdbcName CDATA #REQUIRED
keyColumn (true | false) #REQUIRED
jdbcType (varchar | datetime | decimal) #REQUIRED
jdbcComment CDATA #REQUIRED
>
<!--表间关系:多对一。-->
<!ELEMENT many-to-one EMPTY>
<!ATTLIST many-to-one
refTable ID #REQUIRED
unique (true | false) #IMPLIED
cascade (all | none | save-or-delete) #IMPLIED
>
<!ELEMENT one-to-many EMPTY>
<!ATTLIST one-to-many
refTable ID #REQUIRED
cascade (all | none | save-or-delete) #IMPLIED
>
<!ELEMENT Methods (#PCDATA)>
<!ATTLIST Methods
name CDATA #REQUIRED
class CDATA #REQUIRED
>
大家只要引用这个dtd,自然就知道其厉害之处。
不是我写的dtd,而是dtd
标签:xml,包含,厉害,dtd,实例,引用 From: https://blog.51cto.com/u_2465818/6212420