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

推荐订阅源

量子位
S
Securelist
MyScale Blog
MyScale Blog
Jina AI
Jina AI
罗磊的独立博客
The Cloudflare Blog
美团技术团队
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
雷峰网
雷峰网
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
博客园 - 聂微东
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
T
Tailwind CSS Blog
Attack and Defense Labs
Attack and Defense Labs
博客园_首页
Latest news
Latest news
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Hacker News
The Hacker News
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
D
Docker
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
B
Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
V2EX - 技术
V2EX - 技术
N
News | PayPal Newsroom
Microsoft Security Blog
Microsoft Security Blog

XML | 酷 壳 - CoolShell

PFIF网上寻人协议 | 酷 壳 - CoolShell 语言的数据亲和力 | 酷 壳 - CoolShell Web开发人员速查卡 | 酷 壳 - CoolShell 那些炒作过度的技术和概念 | 酷 壳 - CoolShell SOAP的S是Simple | 酷 壳 - CoolShell 信XML,得自信 | 酷 壳 - CoolShell 信XML,得永生! | 酷 壳 - CoolShell
早期XML Schema中的open content模型 | 酷 壳 - CoolShell
Neo · 2009-04-22 · via XML | 酷 壳 - 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...