[WebService]之Schema
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的更多相关文章
- WebService笔记-Schema约束
Schema约束 俗话说得好 好记性不如烂笔头. 看了下WebService视频,觉得还是得下笔记. 观看的视频地址:http://edu.51cto.com/ ...
- Web环境使用相对路径发布Webservice
常我们的Webservice服务的发布地址都将是一个相对路径,在与Spring一起使用时我们需要引入Cxf配置Webservice的schema,如jaxws,用以定义对应的Webservice. & ...
- WebService - [Debug] undefined element declaration 's:schema'
错误: [ERROR] undefined element declaration 's:schema' line 44 of http://www.webxml.com.cn/WebServices ...
- 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 ...
- WebService . Schema约束
1. namespace 相当于schema文件的id 2. targetNamespace属性 用来指定schema文件的namespace的值 3. xmlns属性 引入一个约束, 它的值是一个s ...
- webService学习之路(二):springMVC集成CXF快速发布webService
继上一篇webService入门之后,http://www.cnblogs.com/xiaochangwei/p/4969448.html ,现在我将我周六在家研究的结果公布出来 本次集成是基于之前已 ...
- WebService 概念和工作原理(一)
今天我们一起来学习WebService.它到底是干啥用的? Web service是一个平台独立的,低耦合的,自包含的.基于可编程的web的应用程序,可使用开放的XML(标准通用标记语言下的一个子集) ...
- java接口调用——webservice就是一个RPC而已
很多新手一听到接口就蒙逼,不知道接口是什么!其实接口就是RPC,通过远程访问别的程序提供的方法,然后获得该方法执行的接口,而不需要在本地执行该方法.就是本地方法调用的升级版而已,我明天会上一篇如何通过 ...
- webservice入门实例,CXF方式
1.下载CXF,及先关jar包. CXF 下载地址:http://cxf.apache.org/download.html,选择"File"列中的zip格式下载.解压后可以看到一些 ...
随机推荐
- hdu - 1240 Nightmare && hdu - 1253 胜利大逃亡(bfs)
http://acm.hdu.edu.cn/showproblem.php?pid=1240 开始没仔细看题,看懂了发现就是一个裸的bfs,注意坐标是三维的,然后每次可以扩展出6个方向. 第一维代表在 ...
- HDFS的基本shell操作,hadoop fs操作命令
(1)分布式文件系统 随着数据量越来越多,在一个操作系统管辖的范围存不下了,那么就分配到更多的操作系统管理的磁盘中,但是不方便管理和维护,因此迫切需要一种系统来管理多台机器上的文件,这就是分布式文件管 ...
- 读写INI辅助类
using System.Text; using System.Runtime.InteropServices; using System; namespace Benson.INI读写 { #reg ...
- core--线程调度
线程的调度和我们用人是同一个道理,假如我们是公司的CEO,你的手下有7名大将,10名美女,100000名普通员工,现在你的任务是在1年内情切慰问完所有的员工.你将如何安排这个行程?先从那些人开始?从哪 ...
- Spring MVC的UrlBasedViewResolver和InternalResourceViewResolver
Spring MVC使用ViewResolver来根据controller中返回的view名关联到具体的View对象.使用View对象来渲染返回值以生成最终的视图,如html,json或pdf等. S ...
- quartz的触发器CronTriggerBean 配置
一个Quartz的CronTrigger表达式分为七项子表达式,其中每一项以空格隔开,从左到右分别是:秒,分,时,月的某天,月,星期的某天,年:其中年不是必须的,也就是说任何一个表达式最少需要六项! ...
- JS Array常用方法indexOf/filter/forEach/map/reduce详解
Array共有九个方法 Array.prototype.indexOf Array.prototype.lastIndexOf Array.prototype.every Array.protot ...
- asp.net web forms和asp.net mvc比较
ASP.NET Webforms Behind Code的好处和存在的问题 ASP.NET Webforms是一个RAD/VISUAL(快速可视化)的Web程序开发技术.也就是说,开发者简单地拖拽控件 ...
- 堆Heap
#pragma once#include <vector> // 小堆template<class T> //仿函数struct Less{ bool opera ...
- mysql约束(自己原先总结的有点不准)
约束* 约束是添加在列上的,用来约束列的! 1. 主键约束(唯一标识) ****非空*** ****唯一*** ****被引用****(学习外键时) * 当表的某一列被指定为主键后,该列就不能为空,不 ...