schema入门

1:schema出现的目的是通过一个更加合理的方式来编写xml文件的限制(以XML语法的方式)

2:schema可以使用命名空间来支持多个名称相同的元素

3:schema可以很好的的完成对JAVA或者所有的对象的修饰并且提供了大量的数据类型

<?xml version="1.0" encoding="UTF-8"?>
<!-- schema xmlns:xsd="http://www.w3.org/2001/XMLSchema 表示schema的命名空间,不能改动,为它定义命名空间为xsd,以后的元素必须为xsd才能使用 -->
<!-- targetNamespace="http://www.example.org/01" 被其它地方引用的名称 -->
<!-- xmlns:tns="http://www.example.org/01" 默认命名空间,只能有一个不加前缀 -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/01"
xmlns:tns="http://www.example.org/01" elementFormDefault="qualified">
<element name="user">
<complexType>
<sequence>
<element name="id" type="int"></element>
<element name="username" type="string"></element>
<element name="born" type="date"></element>
</sequence>
</complexType>
</element>
</schema>

验证方式一:

<?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></id>
<username>admin</username>
<born>--</born>
</user>

验证方式二:

<?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></id>
<username>admin</username>
<born>--</born>
</user>

总结:

[WebService]之Schema的更多相关文章

  1. WebService笔记-Schema约束

                        Schema约束 俗话说得好 好记性不如烂笔头. 看了下WebService视频,觉得还是得下笔记. 观看的视频地址:http://edu.51cto.com/ ...

  2. Web环境使用相对路径发布Webservice

    常我们的Webservice服务的发布地址都将是一个相对路径,在与Spring一起使用时我们需要引入Cxf配置Webservice的schema,如jaxws,用以定义对应的Webservice. & ...

  3. WebService - [Debug] undefined element declaration 's:schema'

    错误: [ERROR] undefined element declaration 's:schema' line 44 of http://www.webxml.com.cn/WebServices ...

  4. spring 与 CXF 整合 webservice 出现error “Unable to locate Spring NamespaceHandler for XML schema namespace” 总结

    我试了多个版本的spring 发现 出现error : Unable to locate Spring NamespaceHandler for XML schema namespace 并非都是sp ...

  5. WebService . Schema约束

    1. namespace 相当于schema文件的id 2. targetNamespace属性 用来指定schema文件的namespace的值 3. xmlns属性 引入一个约束, 它的值是一个s ...

  6. webService学习之路(二):springMVC集成CXF快速发布webService

    继上一篇webService入门之后,http://www.cnblogs.com/xiaochangwei/p/4969448.html ,现在我将我周六在家研究的结果公布出来 本次集成是基于之前已 ...

  7. WebService 概念和工作原理(一)

    今天我们一起来学习WebService.它到底是干啥用的? Web service是一个平台独立的,低耦合的,自包含的.基于可编程的web的应用程序,可使用开放的XML(标准通用标记语言下的一个子集) ...

  8. java接口调用——webservice就是一个RPC而已

    很多新手一听到接口就蒙逼,不知道接口是什么!其实接口就是RPC,通过远程访问别的程序提供的方法,然后获得该方法执行的接口,而不需要在本地执行该方法.就是本地方法调用的升级版而已,我明天会上一篇如何通过 ...

  9. webservice入门实例,CXF方式

    1.下载CXF,及先关jar包. CXF 下载地址:http://cxf.apache.org/download.html,选择"File"列中的zip格式下载.解压后可以看到一些 ...

随机推荐

  1. AOJ -0189 Convenient Location && poj 2139 Six Degrees of Cowvin Bacon (floyed求任意两点间的最短路)

    http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=78207 看懂题就好. 求某一办公室到其他办公室的最短距离. 多组输入,n表示 ...

  2. Android Touch(2)View.OnTouchEvent与View.OnTouchListener区别

    1,在官方文档 docs/reference/android/view/View.OnTouchListener.html 中对OnTouchListener的描述 Interface definit ...

  3. [HDOJ5573]Binary Tree(找规律,贪心)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5573 这个题……规律暂时还找不到,先贡献两发TLE的代码吧,一个dfs一个状压枚举. #include ...

  4. leetcode:Implement Stack using Queues 与 Implement Queue using Stacks

    一.Implement Stack using Queues Implement the following operations of a stack using queues. push(x) - ...

  5. 【转】Android之内存泄漏调试学习与总结

    大家有或经常碰到OOM的问题,对吧?很多这样的问题只要一出现相信大家的想法跟小马的一样,就是自己的应用:优化.优化.再优化!而且如果出现类似于OOM这样级别的问题,根本就不好处理,LogCat日志中显 ...

  6. $ is not defined错误类型

    <script src='js/jtouch/jquery.js'></script> <script type="text/javascript"& ...

  7. Bootstrap_CSS全局样式

    一.HTML5 文档类型 Bootstrap 使用到的某些 HTML 元素和 CSS 属性需要将页面设置为 HTML5 文档类型.在你项目中的每个页面都要参照下面的格式进行设置. <!DOCTY ...

  8. npm和bower

    npm用于管理node.js 的backend依赖模块:这些模块以node的require来调用 bower用于管理frontend的js依赖模块,这些模块用<script src=" ...

  9. 51nod1406 与查询

    这题卡I/O...dp一下... #include<cstdio> #include<cstring> #include<cctype> #include<a ...

  10. ajax连接数据库并操作数据库

    Response.Write("<script  type='text/javascript' language='javascript' >alert('用户名不能为空!请输入 ...