Some simple facts about XML (二)

下面的内容主要来自:

Practical XML Schema (A Java programmers guide to XML Schema and Namespaces)

http://www.javaworld.com/javaworld/jw-08-2005/jw-0808-xml.html?page=1#resources

 

 DTD & Schema

有两种方式定义XML的结构:Document Type Definition (DTD)  和 Schema。

 

DTD

   - DTDs were inherited from XML's origins as SGML (Standard Generalized Markup Language) and, as such, are limited in their expressiveness.

   - DTDs are for expressing a text document's structure, so all entities are assumed to be text.

   -  DTDs enforce a strict ordering of elements; schemas have a more flexible range of options (elements can be optional as a group, in any order, in strict sequence, etc.)

   - DTDs have their own syntax

 

XML Schema

   - The XML Schema language more closely resembles the way a database describes data。

   - Schemas provide the ability to define an element's type (string, integer, etc.) and much finer constraints (a positive integer, a string starting with an uppercase letter, etc.)

   - schemas are written in XML

 

 

XML 1.0 或 1.1

 XML exists in two versions: 1.0 defined in 1998 and 1.1 defined in 2004. XML 1.1 adds very little to 1.0: support for defining elements and attributes in languages such as Mongolian or Burmese, support for IBM mainframe end-of-line characters, and almost nothing else. For the vast majority of applications, these changes are not needed. Plus, a document declared as XML 1.1 will be rejected by a 1.0 parser. So stick with 1.0.

 

Well-formed and valid XML

well-formed就是文法正确,valid就是xml还要符合对应的DTD或Schema的定义(如果有的话)

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值