其实XML和SGML并无太大区别,只要在写SGML格式的DocBook时遵从:
|
用 XML 撰写DocBook文档
An XML Declaration
不像 SGML的Declaration 可有可无,XML 文档必须以 An XML Declaration开始。
<?xml version="1.0" standalone="no"?>
A Document Type Declaration
DocBook XML documents 需要有一个 Document Type Declaration ,虽然这并不是XML所必须。
<?xml version='1.0'?> <!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN" "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">
An Internal Subset
在一个Document Type Declaration 中,可以包含一个或者多个 Internal Subset,如:
<?xml version='1.0'?> <!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4/EN" "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd" [ <!ENTITY nwalsh "Norman Walsh"> <!ENTITY chap1 SYSTEM "chap1.sgm"> <!ENTITY chap2 SYSTEM "chap2.sgm"> ]>
The Document (or Root) Element
如下面的 <boot> 和 </boot> 即是该文档的唯一根元素。
<?xml version='1.0'?> <!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN" "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd" [ <!ENTITY nwalsh "Norman Walsh"> <!ENTITY chap1 SYSTEM "chap1.sgm"> <!ENTITY chap2 SYSTEM "chap2.sgm"> ]> <book>...</book>
Copyright © 2006 WorldHello 开放文档之源 计划 |