DTD及Schema的使用中一些小的问题及解决方案

来源:互联网 发布:ktv唱歌技巧 知乎 编辑:程序博客网 时间:2024/06/05 03:05

DTD

元素出现个数:

? : 0-1

*  : 0-n

+ :1-n

 

Schema:

无序Children的实现,可以用all或者choice

区别:

all每个元素只能出现最少0次,最多1次

choice每个元素最多可以出现n次,最少0次

 

简单元素的attribute属性

例如:<text name="hello" type="string">HelloWorld</text>

Schema的实现是:

<element name="text" minOccurs="0"><complexType><simpleContent><extension base="string"><attribute name="name" type="string" /><attribute name="type" type="string" /></extension></simpleContent></complexType></element>

 

原创粉丝点击