first.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="www.myweb.com"
xmlns="www.myweb.com">
<xs:simpleType name="bid">
<xs:restriction base="xs:string">
<xs:pattern value="[A]\d{6}"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
second.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="www.myweb.com"
targetNamespace="www.myweb.com">
<xs:simpleType name="aid">
<xs:restriction base="xs:string">
<xs:pattern value="[c]\d{6}"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
third.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="www.myweb.com"
xmlns="www.myweb.com"> <xs:include schemaLocation="first.xsd"/>
<xs:include schemaLocation="second.xsd"/> <xs:element name="books" type="infotype"/> <xs:complexType name="infotype">
<xs:sequence>
<xs:element name="book" type="booktype"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="booktype">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="atype"/>
</xs:sequence>
<xs:attribute name="bookid" type="bid"/>
</xs:complexType>
<xs:complexType name="atype">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
<xs:attribute name="authorid" type="aid"/>
</xs:complexType>
</xs:schema>

说明:

first.xsd:定义简单类型, 并指定目标命名空间为"www.myweb.com";

second.xsd:定义简单类型, 并指定目标命名空间为"www.myweb.com";

third.xsd:定义复杂类型,并引用first.xsd, second.xsd,引用这两个schema文件前提是目标命名空间一致。因为third.xsd引用了first.xsd, second.xsd所经必须指定默认命名空间为"www.myweb.com",否则无法引用firtst.xsd, second.xsd中定义的简单类型数据;

目标命名空间:指定被此Schema文档约束的元素及数据类型都来自于的命名空间;

默认命名空间:指定当前XML文档中使用的元素及数据类型都来自于的命名空间;

xml Schema include的更多相关文章

  1. XML Schema and XMLspy notes

    Introduction An xml documents consists of elements, attributes and text. There are two structures in ...

  2. XML详解:第二部分 XML Schema

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  3. 用xerces-c来进行xml schema校验

    在xerces-c的官方站点上有文章指引说明是怎样进行xml schema校验. http://xerces.apache.org/xerces-c/schema-3.html 给出的样例代码: // ...

  4. XML 与 XML Schema的使用教程

    引言:我写本文的宗旨在于给需要使用XML,而又对XML不是很熟悉的人们提供一种使用思路,而不没有给出具体的     使用方法,至于下文中提到的使用方法,还未尝试过,都是从网上整理而来! 一.概述 什么 ...

  5. 打成Jar包后运行报错 Unable to locate Spring NamespaceHandler for XML schema namespace

    MAVEN项目,在IDEA中运行正常,但是把它打成jar包后再运行就会出现异常:   Exception in thread "main" org.springframework. ...

  6. XSD(XML Schema Definition)用法实例介绍以及C#使用xsd文件验证XML格式

    XML Schema 语言也称作 XML Schema 定义(XML Schema Definition,XSD),作用是定义 XML 文档的合法构建模块,类似 DTD,但更加强大. 作用有: ①定义 ...

  7. XML Schema命名空间解析

    URI Web中汇集了各种资源.资源可以是具有标识的任何事物, 如文档. 文件. 菜单项. 计算机. 服务等, 甚至可以包括人. 组织和概念[BernersLee 1998].在Web体系结构中, ...

  8. 【转】XSD (xml Schema Definition)

    来自:http://www.cnblogs.com/newsouls/archive/2011/10/28/2227765.html Xml Schema的用途 1.  定义一个Xml文档中都有什么元 ...

  9. C#与XML Schema的问题

    http://bbs.csdn.net/topics/50493564 weileily: 用XmlSchema.Read方法读取了一个xsd文件,请问如何遍历检索器中的ComplexType与Sim ...

随机推荐

  1. js-图片轮播

    <!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content=&q ...

  2. sqlserver 自动创建作业执行备份数据库

    declare @name varchar(250)set @name='I:\dydb_n\dydb_n'+convert(varchar(50),getdate(),112)+ left(righ ...

  3. Speech Synthesis

    <Window x:Class="Synthesizer.MainWindow" xmlns="http://schemas.microsoft.com/winfx ...

  4. 19_python_反射

    一.内置函数(补充)          1.issubclass() -- 方法用于判断参数 class 是否是类型参数 classinfo 的子类.   语法格式:issubclass(class, ...

  5. underscore.js源码研究(6)

    概述 很早就想研究underscore源码了,虽然underscore.js这个库有些过时了,但是我还是想学习一下库的架构,函数式编程以及常用方法的编写这些方面的内容,又恰好没什么其它要研究的了,所以 ...

  6. Swift5 语言参考(五) 语句

    在Swift中,有三种语句:简单语句,编译器控制语句和控制流语句.简单语句是最常见的,由表达式或声明组成.编译器控制语句允许程序更改编译器行为的各个方面,并包括条件编译块和行控制语句. 控制流语句用于 ...

  7. 【Junit4】:要点随笔

    1. 引入Junit4的Maven依赖 <dependencies> <dependency> <groupId>junit</groupId> < ...

  8. 【Vue】【Router】手动跳转用 this.$router.push() 时 $router 未定义的问题

    初入Vue,手写路由跳转时的问题: toXxxRoute: () => { this.$router.push({'path': '/xxx', 'name': 'xxx'}) } 由于使用了箭 ...

  9. Vue 项目配置

    配置Vue的app项目首先需要配置本地环境. 1.下载node.js并且安装.(根据自己电脑参数进行选择) 打开cmd,检查是否安装成功. 分别输入: node -v npm -v 结果如图正确显示出 ...

  10. system表空间空间不足解决办法

    场景描述: 系统表空间空间不足,导致应用无法正常连接!!! 环境描述: ORACLE 11G 查看当前表空间的整体使用情况,以及有没有开启自动扩展,以及扩展的最大限制!!! ---tablespace ...