首页 > 其他 > 详细

如何写一个schema文件

时间:2016-09-20 13:55:55      阅读:238      评论:0      收藏:0      [点我收藏+]
<!-- xmlns:默认的命名空间,一个 schema中只允许有一个xmlns,因为应用这个命名空间的资源不用添加前缀,其他的命名空间需要添加前缀 -->
<!-- targetNamespace:是别的schema或者xml文件引用本schema文件的路径, -->
<!-- targetNamespace和xmlns:tns是一致的,什么意思呢,就是说在本页面如果要引用本页面的一些资源,就要加入tns这个前缀才能引用,不然就是引用默认命名空间xmlns的资源 -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/persion"
    xmlns:tns="http://www.example.org/persion" elementFormDefault="qualified">

    <element name="persion">
        <complexType>
            <sequence>
                <element name="id" type="int"></element>
                <element name="username" type="string"></element>
                <element name="time" type="date"></element>
            </sequence>
        </complexType>
    </element>
</schema>
<?xml version="1.0" encoding="UTF-8"?>
<persion xmlns="http://www.example.org/persion" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.example.org/persion">

    <id>1</id>
    <username>sfz</username>
    <time>1992-01-12</time>
    
</persion>

 

如何写一个schema文件

原文:http://www.cnblogs.com/songfahzun/p/5888440.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!