当前位置: 代码迷 >> Web前端 >> 怎样写XSD资料2
  详细解决方案

怎样写XSD资料2

热度:128   发布时间:2013-04-07 12:50:11.0
怎样写XSD文件2
xsd页面

根元素<person>
子元素<name> 类型string;<birthday>类型date;<age>类型integer;
子元素序列出现。

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:group name="myGroup">

<xs:sequence>

<xs:element name="name" type="xs:string"/>
<xs:element name="birthday" type="xs:date"/>
<xs:element name="age" type="xs:integer"/>

</xs:sequence>

</xs:group>

<xs:element name="person">

<xs:complexType>
<xs:group ref="myGroup"/>
</xs:complexType>

</xs:element>

</xs:schema>



xml页面

<?xml version="1.0" encoding="UTF-8"?>
<person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test2.xsd">

<name>tom</name>
<birthday>2010-10-10</birthday>
<age>10</age>

</person>

  相关解决方案