java学习

java学习

 

编写schema引入xml文件中


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>

posted on 2013-08-15 17:14 杨军威 阅读(185) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜