`
semi_sleep
  • 浏览: 101603 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Notes for XML Schema 20081230

    博客分类:
  • XML
阅读更多
1.The xml schema type system:
(contains attribute?)
  - SimpleType
  - ComplexType (contains element?)
    - SimpleContent
    - ComplexContent (can be mixed with character?)
      - Element Only
      - Mixed
For those "Y", unless otherwise explained, they should be derived from the same type.
 Create New By List  By Union   By Restriction  By Extension
SimpleType N Y Y Y N
ComplexType with SimpleContent N N N Y Y (can extend from SimpleType)
ComplexType with ComplexContent
(Element Only)
Y (don't need to use <complexContext>,
use <sequence>, <any> or <all>)
N N Y Y
ComplexType with ComplexContent
(Mixed)
Y (don't need to use <complexContext>,
use <sequence>, <any> or <all>)
N N Y Y


2.About restriction, if A is restricted from B, then instance of A will always be valid for B. For simpleType, only facets are allow, so it should be true, for ComplexType, this means that you can use restriction to narrow down valid usage of some attributes and elements.

3.About extension, extension is more like template, if A is extended from B, this is equivalent to a datatype created by first copy B's definition and then append A's definition. So extension can be use to add new attribute or element to an existing type, and either instance of A or B may be invalid for the other. For complextContent, is a little special as that the element definition for A and B can be considered to be surrounded by a bigger <sequence>.

4.About polymiorphism, instance of datatype derived by restriction or extension can be used as instance of base datatype by using the "xsi:type" attribute. Note that it's ok for restriction, but it may cause problem in the case of extension, so the "block" attribute in <complexType> or <element> is provided to restrict the use of "xsi:type", the "block" attribute is different form the "final" attribute, the latter one is used to restrict inheritance. Also there's not a "block" attribute for <simpleType>, because its dose not support extension. For simple type derived by union, "xsi:type" can also be use to specify the member type to ease validation (may be also for data binding?).

5.Relationship between datatype, element and attribute. Element and attribute must refer to a datatype (it can be global or anonymous (by nested a <simpleType> or <complexType>)),  some datatype in turn, can contain element or attribute (complexType can contain attribute, complexContent can contain element, element and attribute can also be global (by using the "ref" attribute) or anonymous). For restriction, extension, list or union, if the base datatype is simpleType, it can also be anonymous.

Refer to "MSDN - XML Schema Element" at http://msdn.microsoft.com/en-us/library/ms256142.aspx.
Also Refer to "XML Schema Design Patterns: Is Complex Type Derivation Unnecessary?" at http://www.oreillynet.com/xml/blog/2007/07/derivation_by_implied_restrict.html

分享到:
评论

相关推荐

    Note pad++ XMLTools 3.0.3 安装包

    1. **XML验证**:XMLTools可以自动验证XML文档是否符合其指定的DTD(文档类型定义)或XSD(XML Schema定义)。这有助于确保文档的结构正确无误,遵循预设的规则。 2. **XML格式化**:此插件能够将杂乱无章的XML代码...

    jaxb (XML操作)

    **JAXB(Java Architecture for XML Binding)** 是Java平台中用于处理XML的一种强大的工具,它提供了将XML文档与Java对象之间的映射,从而方便XML数据的解析和生成。通过JAXB,开发者可以轻松地实现XML数据到Java...

    xml存储留言方案php版-回复留言(源代码)

    - SAX(Simple API for XML)是一种事件驱动的XML解析器,适用于处理大型XML文件,因为它不需要一次性加载整个文档到内存。 3. 留言系统设计: - 在本方案中,留言和回复可能被组织成XML文档的元素结构,例如,每...

    notes code for activi

    .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE) .setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000") .setJobExecutorActivate(true) .buildProcessEngine(); ``` 这里...

    XML学习教程

    - **SAX**(Simple API for XML):一种基于事件的解析模型。 - **DOM**(Document Object Model):一种基于树结构的解析模型。 - **开放式标准**: - **制定者**:XML是由W3C(World Wide Web Consortium,...

    thymeleaf-extras-eclipse-plugin-2.1-master.zip

    All you need to do is create an XML file that conforms to the schema above, then bundle that XML file with your JAR. Some notes on where you put that file in the JAR: it cannot go in the default ...

    Struts-notes-all

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"&gt; &lt;servlet-name&gt;action ...

    Axis相关jar包

    Axis1.6版本是该框架的一个稳定版本,包含了对SOAP、WSDL和XML Schema等Web服务标准的良好支持。这个压缩包文件包含了一系列与Axis1.6相关的JAR文件和其他文档,以下是其中每个文件的具体介绍: 1. **release-notes...

    raml-example:一个简单的“Notes” API 的示例 RAML 规范

    8. **模式(Schemas)**:使用JSON Schema或XML Schema定义数据结构,确保输入和输出的数据格式正确。 **"raml-example-master"目录结构** 在解压后的"raml-example-master"文件夹中,我们可能会找到以下内容: 1...

    expat-2.0.1.tar.gz

    - 这个库是非验证的解析器,意味着它不会检查 XML 是否符合其 DTD(文档类型定义)或 XML Schema。 - Expat 通过事件驱动的 API 工作,当解析到特定的 XML 元素时(如开始标签、结束标签、字符数据等),会触发预...

    Eclipse Modeling Framework (EMF) Developer Guide

    - **使用 XML Schema 生成模型**: EMF 支持从 XML Schema 定义(XSD)文件生成 EMF 模型。这种方法特别适用于那些已经定义了 XML 格式的数据结构的应用程序。 #### 5. JET 教程 **JET Tutorial Part 1 & 2** 部分...

    PyPI 官网下载 | inspire-schemas-61.2.0.tar.gz

    它可能包括XML Schema定义,用于验证XML文件是否符合特定的结构和语义要求。 使用这样的库,开发者可以更方便地处理和验证与地理空间信息相关的数据,确保其符合欧盟的法规标准,从而促进跨组织、跨国的数据交换。...

    JXBeans-开源

    此外,JXBeans 还支持 XML Schema,可以确保数据的正确性和一致性。 ### 3. 业务流程建模 JXBeans 提供了一套机制,使得业务流程可以被表示为 JavaBean 对象。这样,开发者可以通过操作这些对象来定义、执行和管理...

    NHibernate最新源码

    4. **nhibernate-mapping.xsd和nhibernate-configuration.xsd**:这两个XML Schema定义文件定义了NHibernate的映射文件和配置文件的结构。nhibernate-mapping.xsd用于实体类到数据库表的映射配置,包括属性映射、...

    python3.6.5参考手册 chm

    PEP 526: Syntax for variable annotations PEP 515: Underscores in Numeric Literals PEP 525: Asynchronous Generators PEP 530: Asynchronous Comprehensions PEP 487: Simpler customization of class ...

    ehcache-1.5.0-beta2

    7. **ehcache.xsd**:XML Schema Definition文件,定义了ehcache.xml文件的结构和元素,用于验证配置文件的语法正确性。 8. **ehcache-1.5.0-beta2-javadoc.zip**:包含了Ehcache API的Java文档,有助于开发者理解...

    Python库 | dynabuffers-1.1.0.tar.gz

    1. **什么是序列化与反序列化**:序列化是将数据结构转换为可持久化或可传输的格式,如JSON、XML或二进制格式;反序列化则是相反的过程,将这些格式的数据恢复为原来的对象。在分布式系统、网络通信和持久化存储等...

Global site tag (gtag.js) - Google Analytics