惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
B
Blog
月光博客
月光博客
博客园 - 【当耐特】
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
博客园 - Franky
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Last Week in AI
Last Week in AI
B
Blog RSS Feed
H
Help Net Security

酷 壳 – CoolShell

感染新冠的经历 | 酷 壳 - CoolShell 从一次经历谈 TIME_WAIT 的那些事 | 酷 壳 - CoolShell 网络数字身份认证术 | 酷 壳 - CoolShell 我做系统架构的一些原则 | 酷 壳 - CoolShell 源代码特洛伊木马攻击 | 酷 壳 - CoolShell Go编程模式 : 泛型编程 | 酷 壳 - CoolShell 如何做一个有质量的技术分享 | 酷 壳 - CoolShell Go 编程模式:k8s Visitor 模式 | 酷 壳 - CoolShell Go编程模式:Pipeline | 酷 壳 - CoolShell Go编程模式:委托和反转控制 | 酷 壳 - CoolShell Go 编程模式:Go Generation | 酷 壳 - CoolShell Go编程模式:Map-Reduce | 酷 壳 - CoolShell Go 编程模式:错误处理 | 酷 壳 - CoolShell Go编程模式:切片,接口,时间和性能 | 酷 壳 - CoolShell 百度为什么掉队了 | 酷 壳 - CoolShell 程序员如何把控自己的职业 | 酷 壳 - CoolShell 计时攻击 Timing Attacks | 酷 壳 - CoolShell Rust语言的编程范式 | 酷 壳 - CoolShell HTTP的前世今生 | 酷 壳 - CoolShell 记一次Kubernetes/Docker网络排障 | 酷 壳 - CoolShell 可视化编程 | 酷 壳 - CoolShell 程序的本质复杂性和元语言抽象 | 酷 壳 - CoolShell 伙伴分配器的一个极简实现 | 酷 壳 - CoolShell C++11的Lambda使用一例:华容道求解 | 酷 壳 - CoolShell C++面试中string类的一种正确写法 | 酷 壳 - CoolShell C++模板”>>”编译问题与词法消歧设计 | 酷 壳 - CoolShell 数据即代码:元驱动编程 | 酷 壳 - CoolShell 数据的游戏:冰与火 | 酷 壳 - CoolShell 7个示例科普CPU Cache | 酷 壳 - CoolShell 加班与效率 | 酷 壳 - CoolShell
早期XML Schema中的open content模型 | 酷 壳 - CoolShell
Neo · 2009-04-22 · via 酷 壳 – CoolShell

摘要:在看SDO的一些规范文档,可能会出现open content这样的词组,上网查了相关资料,发现这是一种XML Schema的模型,本文就描述了XML Schema的Open Content模型的含义,在最新的XML Schema规范中,好像已经没有Open模型,它的等价物是any模型。

早期发布的XML Schema规范中支持一种新的element定义,在这个定义中,你可以将XML的Element的内容定义为开放的。下面我们将会介绍一下XML的Open Content 模型。

在Open Content模型中,如果一个XML的元素在XML Schema中被声明为开放的,那么这个Schema对应的XML文档的实例就可以包含一个没有在Schema中罗列的子元素。例如,一个包含着如下的XML Schema的Schema文件

      <element name=&quot;Book&quot;>
           <type>
               <element name=&quot;Title&quot; type=&quot;string&quot;/>
               <element name=&quot;Author&quot; type=&quot;string&quot;/>
               <element name=&quot;Date&quot; type=&quot;string&quot;/>
               <element name=&quot;ISBN&quot; type=&quot;string&quot;/>
               <element name=&quot;Publisher&quot; type=&quot;string&quot;/>
           </type>
      </element>

这个book element的声明意味着这个Schema的实例XML文件必须包含5个元素 – Title,Author,Date,ISBN,Pbulish。例如:

     <Book>
         <Title>Illusions The Adventures of a Reluctant Messiah</Title>
         <Author>Richard Bach</Author>
         <Date>1977</Date>
         <ISBN>0-440-34319-4</ISBN>
         <Publisher>Dell Publishing Co.</Publisher>
     </Book>

假设,在实例XML文件,你希望增加book的另外一个子元素,比如,你希望增加一个到某一个网页的连接:

     <Book>
         <Title>Illusions The Adventures of a Reluctant Messiah</Title>
         <Author>Richard Bach</Author>
         <Date>1977</Date>
         <ISBN>0-440-34319-4</ISBN>
         <Publisher>Dell Publishing Co.</Publisher>
         <AuthorsWebPage xlink:href=&quot;<a href=&quot;http://www.rbach.com&quot;/&quot;>http://www.rbach.com&quot;/</a>>
    </Book>

对于上面这个XML文件,XML Schema分析器将会认为这个XML文件是无效的XML,因为上面的文件的包含了Scheme中没有定义的元素。但是在我们的应用场景中,我们可能会希望XML Schema分析器不要报错,因为,应用程序自己知道如何处理<AuthorsWebPage>这个元素。为了达到这个目的,我们就可以将Book声明为开放的。

Loading...