myschema文件如下:<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="
http://www.w3.org/2001/XMLSchema"
targetNamespace="
http://www.example.org/myschema"
xmlns:tns="
http://www.example.org/myschema"
elementFormDefault="qualified">
<element name="user">
<complexType>
<sequence>
<element name="id" type="int"/>
<element name="username" type="string"/>
<element name="time" type="date"/>
</sequence>
</complexType>
</element>
</schema>
xml文件如下1:
<?xml version="1.0" encoding="UTF-8"?>
<user xmlns="
http://www.example.org/01"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.example.org/01">
<id>1</id>
<username>zhangsan</username>
<born>1989-12-22</born>
</user>
xml文件2如下:
<?xml version="1.0" encoding="UTF-8"?>
<user xmlns="
http://www.example.org/01"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="01.xsd">
<id>11</id>
<username>lisi</username>
<born>1988-11-11</born>
</user>