javaweb学习之XML(2)

来源:互联网 发布:十月妈咪淘宝旗舰店 编辑:程序博客网 时间:2024/06/06 00:15

Schema约束

名称空间 声明以xmlns或xmlns:作为前缀

<元素名 xmlns:prefixname="URL">
默认名称空间 <元素名 xmls="URL">

引入shema文档

xsi:schemaLocation="名称空间(空格)文档位置"

不使用名称空间引入Schema   xsi:noNamespaceSchemaLocation="文档位置"> 注意.xsd与实例文档在同一目录
元素定义<xs:element name="xxx"type="yyy"/>

属性定义<xs:attribute name="xxx"type="yyy"/>

简单元素:只包含字符数据的元素。xs:simpleType 

xs:restriction  minInclusive maxInclusiveenumeration pattern 

复杂元素:xs:complexContent

包含子元素<xs:complexType>

<xs:sequence>

<xs:element name="  "type=" "/>

<xs:element name="  "type=" "/>

</xs:sequence>

</xs:complexType>

只包含文本数据simpleContent

包含字符和文本<xs:complexType mixed="true"> 默认情况mixed值为false


0 0