`

Why Schema

    博客分类:
  • XML
xml 
阅读更多

Why Scheme?和DTD功能一样
DTD语法怪异,SCML的残留
DTD没有数据类型
没有对DTD的编程接口
Schema简单,本身就是XML,克服了以上的缺点


实例1:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="quantity" type="nonNegativeInteger">
    <!--nonNegativeInteger代表的就是非负数-->
    </xs:element>

<quantity>5</quantity>可以
<quantity>-13</quantity>不可以



实例2:
<?xml version="1.0" encoding="gb2312"?>
<xs:schema xmlna:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="丛书">
       <xs:complexType>
         <xs:sequence>
           <xs:element name="书">
         <xs:element name="名" minoccurs="1"></xs:element>
         <xs:element name="人"></xs:element>
         <xs:element name="价">
            <xs:attribute name="unit">
                <xs:attribute value="RMB"/>
                <xs:attribute value="美元"/>
                <xs:attribute value="日元"/>
            </xs:attribute>
         </xs:element>
           </xs:element>
          </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>


注意:
minoccurs="1"代表至少出现一次
<xs:attribute name="unit">代表枚举类型
           

分享到:
评论

相关推荐

    Learning GraphQL: Declarative Data Fetching for Modern Web Apps

    Why is GraphQL the most innovative technology for fetching data since Ajax? By providing a query language for your APIs and a runtime for fulfilling queries with your data, GraphQL presents a clear ...

    MySQL-5.7新增功能全揭秘中文版

    - **基准测试**:MySQL 官方提供了详细的基准测试报告,可参考 [MySQL 官网](http://www.mysql.com/why-mysql/benchmarks/) 或者 [MySQL Benchmark 下载页面](http://dev.mysql.com/downloads/benchmarks.html) 获取...

    Teach Yourself XML in 21 Days

    In Week One, he starts from basic syntax, and discusses XML document structure, document types, and the benefits of XML Schema. Week Two covers formatting using either CSS or the Extensible Sytle...

    21天学习XML第3版

    In Week One, he starts from basic syntax, and discusses XML document structure, document types, and the benefits of XML Schema. Week Two covers formatting using either CSS or the Extensible Sytle...

    MongoDB The Definitive Guide

    * Learn how MongoDB’s schema-free data model handles documents, collections, and multiple databases * Execute basic write operations, and create complex queries to find data with any criteria * ...

    Mastering.Apache.Spark.178397146

    Create a schema in Spark SQL, and learn how a Spark schema can be populated with data Study Spark based graph processing using Spark GraphX Combine Spark with H20 and deep learning and learn why it is...

    eclipse Modeling Framework

    Discover how EMF makes modeling easy and practical enough for virtually any Java project-and why EMF modeling provides a solid foundation for fine-grained interoperability and data sharing across ...

    XML相关技术和应用架构及在金融行业的应用

    首先,为何XML(Why XML)存在,可以从其特点及应用领域来理解。XML的文本基础(text-based)和对国际语言字符集的支持使其成为跨平台、跨语言交换数据的理想选择。它的历史沿革使其继承了SGML(标准通用标记语言)...

    Solr.In.Action目录整理版

    Solr使用了类似于数据库的概念,通过schema来定义索引的结构,书中可能还会介绍如何根据需求定制schema,实现对数据的精确搜索。 查询处理是实现高效信息检索的另一个关键点。Solr提供了一种基于HTTP的查询语言,...

    Oracle Security

    The User Interface: User Versus Schema Objects Tables Table Triggers Views Stored Programs Synonyms Privileges Roles Profiles Chapter 4 The Oracle Data Dictionary Creating and Maintaining ...

    Mathematics in Computing

    6.7 Schemas and Schema Composition 6.8 Reification and Decomposition 6.9 Proof in Z 6.10 Review Questions 6.11 Summary 7 Number Theory 7.1 Introduction 7.2 Elementary Number Theory 7.3 Prime Number ...

    Visual.Studio.Tools.for.Office.Using.C.Sharp.with.Excel.Word.Outlook.and.InfoPath.Sep.2005

    An Introduction to Office Programming Why Office Programming? Office Object Models Properties, Methods, and Events The Office Primary Interop Assemblies (PIAs) Conclusion ...

    Visual.Studio.Tools.for.Office.Using.C.Sharp.with.Excel.Word.Outlook.and.InfoPath.Sep.2005.part2

    An Introduction to Office Programming Why Office Programming? Office Object Models Properties, Methods, and Events The Office Primary Interop Assemblies (PIAs) Conclusion ...

    藏经阁-LinuxCon2018.pdf

    首先,"Why OpenMessaging"部分强调了开放消息传递的重要性。在快速发展的云计算环境中,OpenMessaging旨在解决不同云服务提供商之间的互操作性和标准化问题。它提供了一种跨平台、跨语言的消息传递规范,确保数据的...

    Django 1.0 Website Development.pdf

    Models: designing an initial database schema 31 The link data model 32 The user data model 35 The bookmark data model 36 Templates: creating a template for the main page 38 Putting it all ...

    edit test for 2019 git版

    【描述】"just For test upload please delete it why i cannot delete ?" 提到的是一个测试上传的过程,并且遇到了删除问题。在使用Git时,可能由于权限问题、未正确使用git命令或者文件被锁定,导致无法删除。在...

    Learn.Search.Engine.Optimization.With.Smart.Internet.Marketing.Strategies 2018

    Why is this so? Google are constantly evolving. Recent changes: 1. September, 2017 - Google becomes Apple's default search provider for Siri, iOS search, and Spotlight search on Mac OS, providing a ...

    programming_the_semantic_web.pdf

    1.Why Semantics? ........................................................ 3 Data Integration Across the Web 4 Traditional Data-Modeling Methods 5 Tabular Data 6 Relational Data 7 Evolving and ...

    openjpa2.0英文版API

    - **XML Schema**: 提供了一个 XML 架构示例,展示了如何使用 XML 文件定义元数据。 ##### 3.5 Persistence - **persistence.xml**: 配置文件的结构和用法,包括如何定义持久化单元。 - **Non-EE Use**: 在非 EE ...

    Android Retrofit2+Okhttp3+Rxjava通过SOAP协议请求WebService

    return "&lt;soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"&gt;" ...

Global site tag (gtag.js) - Google Analytics