XML schema 学习笔记

XML Schema

2008-10-26

XML schema

XML schema 用来描述XML文档的类型,是对文档更高层的抽象。

描述语言

XML Schema描述语言有:DTD, XML Schema等。

DTDXML规范所固有的,功能相对有限,除了用来描述schema,还可以有其它的用途。

什么是 XML Schema?

XML schema语言之一,由W3C 发布。



XML Schema 定义了XML文档必须遵循的规则。这些规则通过 data model 来描述,包括:


  • the vocabulary (element and attribute names)

  • the content model (relationships and structure)

  • the data types.


XML Schema 的数据模型依赖于具体的data types。通过验证的XML文档将生成post-validation infoset,这使得XML文档有了类型信息,从而可以将文档当做对象看待,使用OOP技术来处理XML文档。这对XML文档处理软件的开发非常有用。


验证(Validation

检查XML文档是否遵循schema的过程,称之为验证。

验证有以下几个级别:

  • The validation of the markup -- controlling the structure of a document.

  • The validation of the content of individual leaf nodes (datatyping)

  • The validation of integrity, i.e. of the links between nodes within a document or between documents.

  • Any other tests (often called "business rules").

目前schema对前两种验证支持的比较好,对link 验证的支持很弱。


工具

XMLSpy

altova 公司出品;

使用XMLSpy创建schema的步骤:

  1. 创建Simple data type;

  2. 创建Complex data types;

  3. 创建elements, 及相关的Attributes;

  4. 创建elements 之间的关系,如:包含,顺序,可选等;








發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章