).
David Mertz, Doctoral Protection Expert, Gnosis Software, Inc. October 2000
Content: Create content Prepare DOCBOOK DTD Processing Instruction Creation Chapter Next Reference About Authors
This column continues to discuss use
Docbook to convert the documents of the heterogeneous format into a single, standard XML format. More detailed, some
Docbook tag and discuss how to write basic
Docbook documentation.
If your documentation is similar to me, they contain files from Microsoft Word 3.3, HTML, Word Perfect 7 to ASCII text. Most of the time, you can't even get the software used to create the original document. Fortunately, Docbook, this SGML dialect for creating a general technical document, can help you transfer files to a single standard XML format. In this column, I will explain how to use the XML version of the Docbook DTD to convert existing documents.
Docbook is a fairly complex DTD with hundreds of elements. Fortunately, you don't have to know all Docbook can use it. You will see that the basic element is aligned in logically, most elements follow similar patterns to nested sub-elements.
Creating content - Different methods It is easy to make some small input errors when using DocBook. To use it, the key issue is a good reference to the hand when working. I am biased with O'Reilly quite good hard copy text, but there is also the same online material (see Referring). Through your existing reference, you can create a docBook content in one of the following two ways:
Use a special XML editor using a regular text editor, plus an external confirmator
Docbook is very detailed, so that you need some automated operations to ensure consistent with DTD. Both use these two methods can work for a long time and just occasionally need to confirm and correct some defects.
Most dedicated XML editors can help you enter your element and properties. Many programs provide prompts related to context (such as DocBook) for the available tag or tag list existing in the current DTD. However, you have to know that a special editor is usually flexible, the latter can provide functions such as multiple clipboards, syntax highlight, column marks, and section / function browsing.
Unfortunately, I found that the quality of the XML tool is still unsatisfactory. I tested some XML confirmation and conversion tools, but I haven't found a full correct command line XML confirmator. In fact, I tried to use XML Spy under Win32, using Xeena on other platforms with Java support. Both tools can be confirmed well, but it is very troublesome to use it. (For reviews for XML SPY, XEENA, and General Text Editor, see Resources.)
Preparing Docbook DTD Creating an XML DocBook document is to prepare its declaration. Let's take a look at the list 1, a document declaration example, then gradually understand the different parts of it:
Listing 1. XML document type declaration
XML Version = "1.0"?>
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
]>
xml-stylesheet type = "text / xsl" href = "chapter.xsl"?>
chapter>
XML declarations we first include the Xml> declaration, which indicates that the document is XML. The next is the tag - document type declaration. Take a look at the contents of the document type declaration.
The first thing you should pay attention to the DOCTYPE tag element is the name of the root element (chapter) in the document. It is important to determine which root element to be used because it illustrates the purpose of the document (at least substantially explained). The root element is usually determined to determine the size of the document.
At the highest level, the root element SET can be specified when including two or more BOOks (eg, a collection of reference materials). In this case, you don't have to put eachthing in the same file, and use "contain", which has a general explanation in "XML problem # 3". A Book is often created, which is composed of parts or chapters, plus other sections on the same concept level of the section / chapter. More modestly, you can create Article or Chapter, as in the illustrated example in Listing 1. In fact, Chapter or Article is the minimum root element for the DocBook document.
In the declaration, we will follow the public and system identity. The part of the PUBLIC is the SGML feature, and it does not require it in the XML document. If you include it, make sure that its spelling is exactly the same as the spelling in the DTD. DTD is indicated by the URL in the system identity that the latter is where all DOCBOOK definitions are located. If you want to view DTD, you can download the URL. Also be sure to spell the URL correctly, otherwise the confirmation will not find DTD.
Finally, in the mark square brackets is "internal subset", it is just a way to declare the special characteristics in the document. In this example, I created an alias for the name entered on the American keyboard.
Processing instruction list 1 After the document type declaration mark is the processing instruction XML-Stylesheet ...>. I will discuss extensible style sheet language conversion (XSLT) in detail in the next "XML Question" column. However, the processing instruction is similar to the cascaded style sheet (CSS) of the HTML document. In this example, I added a reference to the XSL document that contains certain rules for converting the DocBook document. Similar to the cascaded style sheet, this type of processing instruction is optional, and even for the conversion tool. Depending on the tool, you can specify the conversion using any required XSLT. The processing instruction is only a means of execution.
Finally, we see the
Creating chapters, articles, forewords, and books, etc. are part of the document. That is, each component is described in more detail in the same topic. Typically, the element name reflects their English meaning.
).
Listing 2. Docbook Chapter tag
Gould, 1987B, Quoting Gunnar Myrdal,
American Dilemma Citetitle> (1944)
attribution>
But there must be still other countless errors of the
Same sort this no living man can yet detect, because
Of The Fog With Our Type of Western Culture
Envelops US. Cultural Influences Have Set Up Up Up Up
Assumptions about the mind, the body, and the
Universe with which we begin; Pose the Questions WE
Ask; Influence the Facts We Seek; Determine THE
Interpretations WE GIVE THESE FACTS; and Direct Our
Reaction to these Interpretations and
CONCLUSONS.
para>
epigraph>
subject1>
sect1>
chapter>
As shown in this example, you need to divide a relatively long chapter into several
The only "smaller" "" smaller "is inline elements. In general, use vertical spaces, frames or similar things with frames to separate the block objects with other blocks. In contrast, the inline elements extend to the words around it, but is marked by different fonts, colors, hyperlinks. In our chapter example, the inscription is like a short section containing two blocks: attribute
The next time, the elements and structures described herein are enough to let you start to create your own docbook documentation. Please refer to the reference part to get an example of the DocBook document I have created, and a more detailed tag document. The next column will demonstrate how to convert our DocBook source documents into other formats and are familiar with the extensible style sheet language conversion, which is useful outside the DocBook application.
Reference
IBM AlphaWorks' XEENA XML editor (90-day free license) provides an overview, running requirement, FAQ, and downloadable copy of Xeena. You can get Xeena's commercial resale license through AlphaWorks. The XML Spy commented on Webreview.com is my review of XML SPY 3.0 and provides links to other XML articles. The text editor of the David Mertz on WebReview.com is comment on the five text editors used in the Different Environment. David Mertz previous "XML Question" column:
XML problem # 1, about using Pickle Module XML Question # 2, about using Python XML_Objectify module XML problem # 3, introduces Docbook's time-only document archiving method to see David's 2000 in June 2000 related XML module "Cute Python" column and use Python's XML developer related resources. Altova's XML SPY Home (Business XML Editor) describes the features of the ALTOVA's XML SPY version and provides examples and downloadable copies. Scholarly Technology Group Based on Web-based XML confirmation (available source, and franchise unrestricted) allows you to paste XML documents into their online format and use full XML 1.0 feature to confirm it. You can access the XMetal home page of Softquad from Softquad (commercial XML editor). It provides an overview, feature description, FAQ, product reviews, and allows you to download and purchase products. Extensibility's XML Instance (Commercial XML Editor) describes XML Instance 1.1 and allows you to download and purchase products. The Sablotron XSL processor (open source) provides an overview and downloadable version of the product. Structured Information Standard Advanced Organizations (OASIS) are central information sources for SGML, XML, and DocBook. OASIS provides detailed overview of DocBook and XML for DocBook and XML, and provides tools, documents, and samples known for DocBook. Best from Docbook: The Definitive Guide, Norman Walsh & Leonard Muellner, O'Reilly, Cambridge, MA 1999, starts to understand more details on DOCBOOK. Or, take a closer look at its electronic version. You can get the HTML introduction of the embossed philosophy of philosophy and XML / DocBook source code. For most XML developers, the text may not attract them, and even don't have much sense to them. But marking as an example may cause some interest. The hypertext version of the DocBook / XML DTD of Robert Stayton is very useful. We must conduct some practices to learn about the DTD format, but in any case, this is also what you need to do with XML. Regarding the author David Mertz no longer a technical reporter: It is inevitably its result. You can contact your life in detail by mertz@gnosis.cx with David, http: //gnosis.cx/publish/. Very welcome to past, this article or future column articles comments and suggestions.