schema约束理解
来源:互联网 发布:苹果自动关机软件哪个 编辑:程序博客网 时间:2024/06/05 18:11
schema 的简单认识
简单重点:只要认识 (增加子元素)
<xs:complexType>
<xs:sequence>
可以嵌套元素就可以了!(增加属性)
<xsd:element name="media">
<xsd:complexType>
<xsd:attribute name="mediaid" type="xsd:integer" />
<xsd:attribute name="status" type="mediaType" />
</xsd:complexType>
</xsd:element>
在<xsd:complexType> </xsd:complexType> 中间增加
小例子:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3school.com.cn"
xmlns="http://www.w3school.com.cn"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" >
<xs:complexType>
<xs:attribute name="mm" type="xs:string"/> (增加元素)
<xs:attribute name="gg" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence> (父元素就一定要在sequence后,在complexType 结束前)
<xs:attribute name="mediaid" type="xs:integer" />
<xs:attribute name="status" type="xs:string" />
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
简单例子:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" <!--规定的命名空间-->
targetNamespace="http://www.w3school.com.cn" <!--自定义的命名空间,自己挂上去-->
xmlns="http://www.w3school.com.cn"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0"?>
<note
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn note.xsd"> <!-自定义的命名空间 ,文档-->
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>
还有不理解的: (看官方文档)
http://www.ibm.com/developerworks/cn/education/xml/x-valid/section5.html
- schema约束理解
- Schema约束
- Schema约束
- Schema约束
- Schema约束
- schema 约束
- schema约束
- XML约束-Schema约束
- XML约束--schema约束
- xml Schema 约束
- xml-schema约束
- XML之Schema约束
- Schema约束快速入门
- Schema约束快速入门
- XML -----Schema 约束
- XML Schema约束
- XML Schema约束
- XML-约束(schema)
- Python源码包下载地址
- sql插入数据的方法以及效率
- MongoDB基本使用
- Document root element "sqlMap", must match DOCTYPE root "sqlMapConfig".
- h264检测是I帧还是P帧
- schema约束理解
- Android编译过程详解(一)
- WSDL
- 微信公众号php开发接口怎么主动推送信息
- Android编译过程详解(二)
- UltraEdit恢复默认设置
- 微信公众号接口推送图片
- Android编译过程详解(三)
- hdu-2368-Alfredo's Pizza Restaurant