Gradually adapt to DocBook XML dialects

xiaoxiao2021-03-06  46

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

"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [

]>

XML declarations we first include the 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 . 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 tag referenced in the declaration root element. The chapter content is placed in this tag.

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.

, , or element structure is similar.

is almost the same as these elements, but the pre-content is typically included in the element. The front content included in the integral part of is , followed by the festival and / or block elements (eg <P>). <title> Element is usually required as a forefront of components and festivals. Most other foresses are optional, but may include authors information, summary, graphics, or other information related to the description component rather than establishing an integral part. Let's take a look at the list 2, a valid, highly streamlined chapter (assuming the document type declaration is described in Listing 1):</p> <p>Listing 2. Docbook Chapter tag</p> <p><chapter></p> <p><title> hegemony, and other passing fads </ title></p> <p><epigraph></p> <p><attribution></p> <p>Gould, 1987B, Quoting Gunnar Myrdal, <Citetitle> AN</p> <p>American Dilemma </ Citetitle> (1944)</p> <p></ attribution></p> <p><para></p> <p>But there must be still other countless errors of the</p> <p>Same sort this no living man can yet detect, because</p> <p>Of The Fog With Our Type of Western Culture</p> <p>Envelops US. Cultural Influences Have Set Up Up Up Up</p> <p>Assumptions about the mind, the body, and the</p> <p>Universe with which we begin; Pose the Questions WE</p> <p>Ask; Influence the Facts We Seek; Determine THE</p> <p>Interpretations WE GIVE THESE FACTS; and Direct Our</p> <p>Reaction to these Interpretations and</p> <p>CONCLUSONS.</p> <p></ para></p> <p></ epigraph></p> <p><SECT1></p> <p><title> day-care devil worship </ title></p> <p><! - Para's, SECT2'S, Epigraph's, And Other Block Elements -> </ subject1></p> <p><SECT1></p> <p><! - more blocks -></p> <p></ sect1></p> <p></ chapter></p> <p>As shown in this example, you need to divide a relatively long chapter into several <SECT1>. This is how much judgment is related to the section, but there are many strategies in the creation festival. You can use the hierarchy of <SECT1> to <SECT5>, you can also use recursive nested <section> elements. For my own purposes - writing philosophical prose - I think the level of the clear number is better. For each type of section, there will be more important I have a completely different feeling, and the number of numbers is quite appropriate. However, for, for example, techniques reference this type of things, the contents of the section can be nested in different places, with different depths. For example, a function call can be described in an overview, and later appear again in the programming example of the chapter. In this case, the <section> element is more suitable, and the nesting level can be up to 5 floors. The throttle element is large, and they are a series of blocks. When the components are shorter, the block element can be started immediately. Basically, the block element is a paragraph or an element in the same concept / hierarchy level (such as a list, equation or illustration). There are other special block types, but these are most common.</p> <p>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 <Attribution> and Inscription <PARA>. The attribute contains <citetitle>, but the reference is often expressed in the inner form in the printed, which may be represented in a slope or underscore format, or a hot link to the book (if generated by HTML).</p> <p>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.</p> <p>Reference</p> <p>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:</p> <p>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.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-58918.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="58918" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.036</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'diQ9bQznkIKus2GsIDW1mA9kFKX0n4Kq91JWNkgt3IayhP8EFL3sWbbFMsIpAZsLJK0kqXuaM7fnGoQk'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>