- 浏览: 45170 次
- 性别:
- 来自: 北京
最新评论
-
fireinwind:
最大线程数 设置后 不生效
我认为破解不成功吧。
resin4 pro 破解 -
loyin:
怎么使用?
resin4 pro 破解 -
hnzhangshi:
学习中,一般在应用中应该用private 会比较好一些吧!
cache-control -
wangxuliangboy:
我想请问下,当搜索的状态怎么保存的,客户端怎么去时时获取。。
...
机票搜索的实现原理 -
tongjian:
看了IndexWriter的API,没发现有设置是否auto ...
更新lucene到2.3 建立索引遇到的困扰
A Simple XML Document
<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified"> <xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
The note element is a complex type because it contains other elements. The other elements (to, from, heading, body) are simple types because they do not contain other elements.
What is a Simple Element?
- xs:string
- xs:decimal
- xs:integer
- xs:boolean
- xs:date
- xs:time
<xs:element name="color" type="xs:string" default="red"/> <xs:element name="color" type="xs:string" fixed="red"/>
What is an Attribute?
Simple elements cannot have attributes. If an element has attributes, it is considered to be of a complex type. But the attribute itself is always declared as a simple type.
<xs:attribute name="xxx" type="yyy"/> <xs:attribute name="lang" type="xs:string" use="required"/>
Restrictions on Values
<xs:element name="age"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="120"/> </xs:restriction> </xs:simpleType> </xs:element>
Restrictions on a Set of Values
<xs:element name="car"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Audi"/> <xs:enumeration value="Golf"/> <xs:enumeration value="BMW"/> </xs:restriction> </xs:simpleType> </xs:element>
Restrictions on a Series of Values
<xs:element name="letter"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[a-z]"/> </xs:restriction> </xs:simpleType> </xs:element>
Restrictions on Whitespace Characters
<xs:element name="address"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:whiteSpace value="preserve"/> # replace | collapse </xs:restriction> </xs:simpleType> </xs:element>
The whiteSpace constraint is set to "preserve", which means that the XML processor WILL NOT remove any white space characters:
The whiteSpace constraint is set to "collapse", which means that the XML processor WILL REMOVE all white space characters (line feeds, tabs, spaces, carriage returns are replaced with spaces, leading and trailing spaces are removed, and multiple spaces are reduced to a single space):
The whiteSpace constraint is set to "replace", which means that the XML processor WILL REPLACE all white space characters (line feeds, tabs, spaces, and carriage returns) with spaces:
Restrictions on Length
<xs:element name="password"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:length value="8"/> </xs:restriction> </xs:simpleType> </xs:element>
<xs:element name="password"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="5"/> <xs:maxLength value="8"/> </xs:restriction> </xs:simpleType> </xs:element>
Restrictions for Datatypes
enumeration | Defines a list of acceptable values |
fractionDigits | Specifies the maximum number of decimal places allowed. Must be equal to or greater than zero |
length | Specifies the exact number of characters or list items allowed. Must be equal to or greater than zero |
maxExclusive | Specifies the upper bounds for numeric values (the value must be less than this value) |
maxInclusive | Specifies the upper bounds for numeric values (the value must be less than or equal to this value) |
maxLength | Specifies the maximum number of characters or list items allowed. Must be equal to or greater than zero |
minExclusive | Specifies the lower bounds for numeric values (the value must be greater than this value) |
minInclusive | Specifies the lower bounds for numeric values (the value must be greater than or equal to this value) |
minLength | Specifies the minimum number of characters or list items allowed. Must be equal to or greater than zero |
pattern | Defines the exact sequence of characters that are acceptable |
totalDigits | Specifies the exact number of digits allowed. Must be greater than zero |
whiteSpace | Specifies how white space (line feeds, tabs, spaces, and carriage returns) is handled |
What is a Complex Element?
A complex element is an XML element that contains other elements and/or attributes.
There are four kinds of complex elements:
- empty elements
- elements that contain only other elements
- elements that contain only text
- elements that contain both other elements and text
<xs:element name="employee" type="personinfo"/> <xs:element name="student" type="personinfo"/> <xs:element name="member" type="personinfo"/> <xs:complexType name="personinfo"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType>
Note that the child elements, "firstname" and "lastname", are surrounded by the <sequence> indicator. This means that the child elements must appear in the same order as they are declared.
You can also base a complex element on an existing complex element and add some elements, like this:
<xs:element name="employee" type="fullpersoninfo"/> <xs:complexType name="personinfo"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="fullpersoninfo"> <xs:complexContent> <xs:extension base="personinfo"> <xs:sequence> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>
Complex Empty Elements
<xs:element name="product"> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:integer"> <xs:attribute name="prodid" type="xs:positiveInteger"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element>
xml:
<product prodid="1345" />
or schema:
<xs:element name="product" type="prodtype"/> <xs:complexType name="prodtype"> <xs:attribute name="prodid" type="xs:positiveInteger"/> </xs:complexType>
Complex Types Containing Elements Only
An "elements-only" complex type contains an element that contains only other elements.
<xs:element name="person" type="persontype"/> <xs:complexType name="persontype"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType>
Complex Text-Only Elements
A complex text-only element can contain text and attributes.
<xs:element name="shoesize"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:integer"> <xs:attribute name="country" type="xs:string" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element>
xml:
<shoesize country="france">35</shoesize>
Complex Types with Mixed Content
A mixed complex type element can contain attributes, elements, and text.
<xs:element name="letter"> <xs:complexType mixed="true"> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="orderid" type="xs:positiveInteger"/> <xs:element name="shipdate" type="xs:date"/> </xs:sequence> </xs:complexType> </xs:element>
xml:
<letter> Dear Mr.<name>John Smith</name>. Your order <orderid>1032</orderid> will be shipped on <shipdate>2001-07-13</shipdate>. </letter>
Note: To enable character data to appear between the child-elements of "letter", the mixed attribute must be set to "true".
Indicators
There are seven indicators:
Order indicators:
- All
- Choice
- Sequence
Occurrence indicators:
- maxOccurs
- minOccurs
Group indicators:
- Group name
- attributeGroup name
All Indicator
The <all> indicator specifies that the child elements can appear in any order, and that each child element must occur only once:
<xs:element name="person"> <xs:complexType> <xs:all> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:all> </xs:complexType> </xs:element> |
Note: When using the <all> indicator you can set the <minOccurs> indicator to 0 or 1 and the <maxOccurs> indicator can only be set to 1 (the <minOccurs> and <maxOccurs> are described later).
Choice Indicator
The <choice> indicator specifies that either one child element or another can occur:
<xs:element name="person"> <xs:complexType> <xs:choice> <xs:element name="employee" type="employee"/> <xs:element name="member" type="member"/> </xs:choice> </xs:complexType> </xs:element> |
Sequence Indicator
The <sequence> indicator specifies that the child elements must appear in a specific order:
<xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element>
Occurrence Indicators
Occurrence indicators are used to define how often an element can occur.
Note: For all "Order" and "Group" indicators (any, all, choice, sequence, group name, and group reference) the default value for maxOccurs and minOccurs is 1.
maxOccurs Indicator
The <maxOccurs> indicator specifies the maximum number of times an element can occur:
<xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="full_name" type="xs:string"/> <xs:element name="child_name" type="xs:string" maxOccurs="10"/> </xs:sequence> </xs:complexType> </xs:element> |
The example above indicates that the "child_name" element can occur a minimum of one time (the default value for minOccurs is 1) and a maximum of ten times in the "person" element.
minOccurs Indicator
The <minOccurs> indicator specifies the minimum number of times an element can occur:
<xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="full_name" type="xs:string"/> <xs:element name="child_name" type="xs:string" maxOccurs="10" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> |
The example above indicates that the "child_name" element can occur a minimum of zero times and a maximum of ten times in the "person" element.
Tip: To allow an element to appear an unlimited number of times, use the maxOccurs="unbounded" statement:
A working example:
An XML file called "Myfamily.xml":
<?xml version="1.0" encoding="ISO-8859-1"?> <persons xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="family.xsd"> <person> <full_name>Hege Refsnes</full_name> <child_name>Cecilie</child_name> </person> <person> <full_name>Tove Refsnes</full_name> <child_name>Hege</child_name> <child_name>Stale</child_name> <child_name>Jim</child_name> <child_name>Borge</child_name> </person> <person> <full_name>Stale Refsnes</full_name> </person> </persons> |
The XML file above contains a root element named "persons". Inside this root element we have defined three "person" elements. Each "person" element must contain a "full_name" element and it can contain up to five "child_name" elements.
Here is the schema file "family.xsd":
<?xml version="1.0" encoding="ISO-8859-1"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="persons"> <xs:complexType> <xs:sequence> <xs:element name="person" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="full_name" type="xs:string"/> <xs:element name="child_name" type="xs:string" minOccurs="0" maxOccurs="5"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
Group Indicators
Group indicators are used to define related sets of elements.
Element Groups
Element groups are defined with the group declaration, like this:
<xs:group name="groupname"> ... </xs:group> |
You must define an all, choice, or sequence element inside the group declaration. The following example defines a group named "persongroup", that defines a group of elements that must occur in an exact sequence:
<xs:group name="persongroup"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:element name="birthday" type="xs:date"/> </xs:sequence> </xs:group> |
After you have defined a group, you can reference it in another definition, like this:
<xs:group name="persongroup"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:element name="birthday" type="xs:date"/> </xs:sequence> </xs:group> <xs:element name="person" type="personinfo"/> <xs:complexType name="personinfo"> <xs:sequence> <xs:group ref="persongroup"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complexType> |
Attribute Groups
Attribute groups are defined with the attributeGroup declaration, like this:
<xs:attributeGroup name="groupname"> ... </xs:attributeGroup> |
The following example defines an attribute group named "personattrgroup":
<xs:attributeGroup name="personattrgroup"> <xs:attribute name="firstname" type="xs:string"/> <xs:attribute name="lastname" type="xs:string"/> <xs:attribute name="birthday" type="xs:date"/> </xs:attributeGroup> |
After you have defined an attribute group, you can reference it in another definition, like this:
<xs:attributeGroup name="personattrgroup"> <xs:attribute name="firstname" type="xs:string"/> <xs:attribute name="lastname" type="xs:string"/> <xs:attribute name="birthday" type="xs:date"/> </xs:attributeGroup>
<xs:element name="person"> <xs:complexType> <xs:attributeGroup ref="personattrgroup"/> </xs:complexType> </xs:element>
The <any> Element
The <any> element enables us to extend the XML document with elements not specified by the schema!
<xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:any minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element>
he <any> and <anyAttribute> elements are used to make EXTENSIBLE documents! They allow documents to contain additional elements that are not declared in the main XML schema.
发表评论
-
resin4 pro 破解
2010-04-29 10:00 4135破解了resin4 pro -
jvm调优,工具
2009-07-20 10:39 0jinfo jinfo:的用处比较简 ... -
jvm介绍,SUN JVM的原理与实践
2009-07-19 20:24 0转自:http://william750214.i ... -
jvm调优,G1
2009-07-19 20:22 0GarbageFirst Garbage Collection ... -
jvm调优,A Collection of JVM Options
2009-07-19 20:06 0A Collection of JVM Options com ... -
jvm调优,Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning
2009-07-19 20:05 0Java SE 6 HotSpot[tm] Virtual M ... -
jvm调优,JDK5.0垃圾收集优化之--Don't Pause
2009-07-19 20:03 0转自:http://calvin.iteye.co ... -
jvm调优,一次Java垃圾收集调优实战
2009-07-19 20:02 0转自:http://www.iteye.com/topic/2 ... -
apache2 resin3 linux
2009-07-17 22:51 1550编译apache 编译resin 编译jdk apac ... -
字节序
2009-04-14 16:34 2660Big Endian and Little Endian ... -
内容编辑器
2009-03-04 14:42 855http://www.kindsoft.net/index.p ... -
memcached
2008-12-04 18:40 1956memcached 完全剖析 : http://tech.i ... -
resin配置文件说明
2008-11-17 16:14 5106<!-- Resin 3.1 配置文件. --> ... -
备份mysql数据库
2008-09-26 17:42 867路径/mysqldump --default-characte ... -
cache-control
2008-08-30 09:53 5026Any valid HTTP headers can be p ... -
安装完bugzilla不能发邮件的问题
2008-08-27 18:37 5382安装完bugzilla不能发邮件的问题: 1. 设置bugz ... -
web工程师应该注意到的页面优化
2008-08-27 18:35 962针对搜索优化: 1. 页面URL静态化。 2. ... -
apache2+resin3.1.5 配置
2008-08-27 18:04 1255安装apache2 1 . 优化连接数。进入apache安装 ... -
关于resin+apache url rewrite
2008-08-27 16:52 1533之前URL rewrite都是通过apache的mod做的。不 ...
相关推荐
`XmlSchema-1.4.6.jar` 是一个包含Java绑定的XML Schema API的库,它为处理XML Schema文档提供了支持。在开发Web服务客户端时,尤其是与基于SOAP(简单对象访问协议)的Web服务交互时,这个库扮演了至关重要的角色。...
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> </xs:schema> ``` 这个例子定义了一个`person`元素,包含`firstName`和`lastName`两个子元素,都是字符串类型。 2. **验证XML文档**:...
【XML与XMLSchema】 XML,全称可扩展标记语言(eXtensible Markup Language),是一种基于标准通用标记语言SGML的简化版本,由万维网联盟(W3C)于1996年开始制定,并在1998年2月10日发布了XML 1.0规范。它的设计...
`xmlschema-core-2.0.3.jar` 是一个Java库,专门用于解析和操作XML Schema文档,它支持XML Schema 1.1标准。 在Spring Web服务中,XML Schema Core库扮演着关键角色。Spring Web Service框架是基于合同优先...
XmlSchema-1.4.7.jar 是一个Java库,它实现了W3C的XML Schema标准,用于处理XML Schema文档。这个版本(1.4.7)可能是该库的一个稳定版本,提供给用户免费使用。XML Schema是XML的一种规范,定义了如何验证XML文档的...
XmlSchema-1.2.jar,xmlschema-1.2.jar,xml.jar
XML Schema是目前国际标准的XML建模工具,本文将对XML Schema进行详细的介绍,帮助读者初步掌握XML Schema的使用方法和XML Schema文档实例的具体语义。 1. 命名空间的使用 XML Schema中命名空间的使用是非常重要的...
"XML Schema知识点" XML Schema是XML语言为基础的,它用于可替代DTD。它用于描述XML文档的结构。XML Schema语言也被称为XML Schema Definition(XSD)。XML Schema的作用是定义一份XML文档的合法组件群,就像DTD的...
### XML Schema 教程知识点详解 #### 一、XML Schema 概述 - **XML Schema 定义**:XML Schema 是一种基于 XML 的语言,用于描述 XML 文档的结构。它定义了 XML 文档中可以出现的元素、属性及其结构,并且指定了...
XML Schema,全称为XML Schema Definition,是用于定义XML文档结构和数据类型的规范,它是W3C(World Wide Web Consortium)制定的一种标准。在本实验"西工大服务计算实验2-1_XML Schema"中,你的任务是编写一个程序...
在“XMLSchema经典例题”中,我们可以深入探讨以下几个核心知识点: 1. **基本元素和类型定义**:XML Schema允许定义基本数据类型,如字符串、整数、浮点数等,并且可以自定义复杂的数据类型。例如,你可以创建一个...
在描述中提到的"apache的xmlschema jar包的api文档"是开发者理解和使用这个API的关键资源。它通常包含详细的方法、类和接口的说明,以及如何使用它们的例子。这些文档能够帮助开发者了解如何在Java程序中导入和使用...
XmlSchema-1.1.jar XmlSchema-1.1.jar
XML Schema实验及答案 XML Schema是基于XML的_schema语言,是一种用于定义XML文档结构的语言。它是W3C制定的一个标准,用于描述XML文档的结构、约束和关系。XML Schema提供了一个强大的工具,用于定义和验证XML文档...
赠送jar包:xmlschema-core-2.1.0.jar; 赠送原API文档:xmlschema-core-2.1.0-javadoc.jar; 赠送源代码:xmlschema-core-2.1.0-sources.jar; 赠送Maven依赖信息文件:xmlschema-core-2.1.0.pom; 包含翻译后的API...
好不容易找到的XmlSchema-1.4.7 jar包,需要的同学速度下载吧。不黑心,只要1分~~~
这个“XMLSchema.chm”文件很可能是一个帮助文档,旨在为学习XML Schema的用户提供详细的指导和参考资料。下面我们将深入探讨XML Schema的相关知识点。 1. **XML Schema的作用**:XML Schema的主要功能是规范XML...
标题中的"AUTOSAR_MMOD_XMLSchema.zip"指的是一个与AUTOSAR(AUTomotive Open System ARchitecture)相关的压缩包文件,它包含了MMOD(Model-based Modeling and Development)的XML Schema定义。AUTOSAR是一种全球...
xmlschema-core-2.0.3.jar;xmlschema-core-2.0.3.jar;xmlschema-core-2.0.3.jar