docbook

Parse DocBook.

In this module:

Language

Name (Aliases)

Description

Filename(s)

Mime Type(s)

DocBook

DocBook

DocBook XMl/SGML computer documentation schema

*.docbook, *.dbk, *.xml

text/docbook, application/sgml

class DocBook[source]

Bases: parce.lang.xml.Xml

DocBook is also valid Xml.

root

Example:

Root lexicon DocBook.root and text:

Text rendered using default theme

 <?xml version="1.0" encoding="UTF-8"?>
 <book xml:id="simple_book" xmlns="http://docbook.org/ns/docbook" version="5.0">
   <title>Very simple book</title>
   <chapter xml:id="chapter_1">
     <title>Chapter 1</title>
     <para>Hello world!</para>
     <para>I hope that your day is proceeding <emphasis>splendidly</emphasis>!</para>
   </chapter>
   <chapter xml:id="chapter_2">
     <title>Chapter 2</title>
     <para>Hello again, world!</para>
   </chapter>
 </book>

Result tree:

<Context DocBook.root at 0-472 (10 children)>
 ├╴<Token ' ' at 0:1 (Whitespace)>
 ├╴<Token '<?' at 1:3 (Delimiter.Bracket.Preprocessed.Start)>
 ├╴<Token 'xml' at 3:6 (Name.Tag.Preprocessed)>
 ├╴<Context DocBook.processing_instruction at 6-39 (11 children)>
 │  ├╴<Token ' ' at 6:7 (Text.Preprocessed)>
 │  ├╴<Token 'version' at 7:14 (Name.Attribute)>
 │  ├╴<Token '=' at 14:15 (Delimiter.Operator)>
 │  ├╴<Token '"' at 15:16 (Literal.String.Double.Start)>
 │  ├╴<Context DocBook.dqstring at 16-20 (2 children)>
 │  │  ├╴<Token '1.0' at 16:19 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 19:20 (Literal.String.Double.End)>
 │  ├╴<Token ' ' at 20:21 (Text.Preprocessed)>
 │  ├╴<Token 'encoding' at 21:29 (Name.Attribute)>
 │  ├╴<Token '=' at 29:30 (Delimiter.Operator)>
 │  ├╴<Token '"' at 30:31 (Literal.String.Double.Start)>
 │  ├╴<Context DocBook.dqstring at 31-37 (2 children)>
 │  │  ├╴<Token 'UTF-8' at 31:36 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 36:37 (Literal.String.Double.End)>
 │  ╰╴<Token '?>' at 37:39 (Delimiter.Bracket.Preprocessed.End)>
 ├╴<Token '\n ' at 39:41 (Whitespace)>
 ├╴<Token '<' at 41:42 (Delimiter)>
 ├╴<Token 'book' at 42:46 (Keyword)>
 ├╴<Context DocBook.attrs at 47-120 (13 children)>
 │  ├╴<Token 'xml:id' at 47:53 (Name.Attribute)>
 │  ├╴<Token '=' at 53:54 (Delimiter.Operator)>
 │  ├╴<Token '"' at 54:55 (Literal.String.Double.Start)>
 │  ├╴<Context DocBook.dqstring at 55-67 (2 children)>
 │  │  ├╴<Token 'simple_book' at 55:66 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 66:67 (Literal.String.Double.End)>
 │  ├╴<Token 'xmlns' at 68:73 (Name.Attribute)>
 │  ├╴<Token '=' at 73:74 (Delimiter.Operator)>
 │  ├╴<Token '"' at 74:75 (Literal.String.Double.Start)>
 │  ├╴<Context DocBook.dqstring at 75-105 (2 children)>
 │  │  ├╴<Token 'http://docbo...rg/ns/docbook' at 75:104 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 104:105 (Literal.String.Double.End)>
 │  ├╴<Token 'version' at 106:113 (Name.Attribute)>
 │  ├╴<Token '=' at 113:114 (Delimiter.Operator)>
 │  ├╴<Token '"' at 114:115 (Literal.String.Double.Start)>
 │  ├╴<Context DocBook.dqstring at 115-119 (2 children)>
 │  │  ├╴<Token '5.0' at 115:118 (Literal.String.Double)>
 │  │  ╰╴<Token '"' at 118:119 (Literal.String.Double.End)>
 │  ╰╴<Token '>' at 119:120 (Delimiter)>
 ├╴<Context DocBook.tag at 120-471 (19 children)>
 │  ├╴<Token '\n   ' at 120:124 (Whitespace)>
 │  ├╴<Token '<' at 124:125 (Delimiter)>
 │  ├╴<Token 'title' at 125:130 (Keyword)>
 │  ├╴<Token '>' at 130:131 (Delimiter)>
 │  ├╴<Context DocBook.tag at 131-155 (4 children)>
 │  │  ├╴<Token 'Very simple book' at 131:147 (Text)>
 │  │  ├╴<Token '</' at 147:149 (Delimiter)>
 │  │  ├╴<Token 'title' at 149:154 (Keyword)>
 │  │  ╰╴<Token '>' at 154:155 (Delimiter)>
 │  ├╴<Token '\n   ' at 155:159 (Whitespace)>
 │  ├╴<Token '<' at 159:160 (Delimiter)>
 │  ├╴<Token 'chapter' at 160:167 (Keyword)>
 │  ├╴<Context DocBook.attrs at 168-187 (5 children)>
 │  │  ├╴<Token 'xml:id' at 168:174 (Name.Attribute)>
 │  │  ├╴<Token '=' at 174:175 (Delimiter.Operator)>
 │  │  ├╴<Token '"' at 175:176 (Literal.String.Double.Start)>
 │  │  ├╴<Context DocBook.dqstring at 176-186 (2 children)>
 │  │  │  ├╴<Token 'chapter_1' at 176:185 (Literal.String.Double)>
 │  │  │  ╰╴<Token '"' at 185:186 (Literal.String.Double.End)>
 │  │  ╰╴<Token '>' at 186:187 (Delimiter)>
 │  ├╴<Context DocBook.tag at 187-348 (19 children)>
 │  │  ├╴<Token '\n     ' at 187:193 (Whitespace)>
 │  │  ├╴<Token '<' at 193:194 (Delimiter)>
 │  │  ├╴<Token 'title' at 194:199 (Keyword)>
 │  │  ├╴<Token '>' at 199:200 (Delimiter)>
 │  │  ├╴<Context DocBook.tag at 200-217 (4 children)>
 │  │  │  ├╴<Token 'Chapter 1' at 200:209 (Text)>
 │  │  │  ├╴<Token '</' at 209:211 (Delimiter)>
 │  │  │  ├╴<Token 'title' at 211:216 (Keyword)>
 │  │  │  ╰╴<Token '>' at 216:217 (Delimiter)>
 │  │  ├╴<Token '\n     ' at 217:223 (Whitespace)>
 │  │  ├╴<Token '<' at 223:224 (Delimiter)>
 │  │  ├╴<Token 'para' at 224:228 (Keyword)>
 │  │  ├╴<Token '>' at 228:229 (Delimiter)>
 │  │  ├╴<Context DocBook.tag at 229-248 (4 children)>
 │  │  │  ├╴<Token 'Hello world!' at 229:241 (Text)>
 │  │  │  ├╴<Token '</' at 241:243 (Delimiter)>
 │  │  │  ├╴<Token 'para' at 243:247 (Keyword)>
 │  │  │  ╰╴<Token '>' at 247:248 (Delimiter)>
 │  │  ├╴<Token '\n     ' at 248:254 (Whitespace)>
 │  │  ├╴<Token '<' at 254:255 (Delimiter)>
 │  │  ├╴<Token 'para' at 255:259 (Keyword)>
 │  │  ├╴<Token '>' at 259:260 (Delimiter)>
 │  │  ├╴<Context DocBook.tag at 260-334 (9 children)>
 │  │  │  ├╴<Token 'I hope that ...s proceeding ' at 260:295 (Text)>
 │  │  │  ├╴<Token '<' at 295:296 (Delimiter)>
 │  │  │  ├╴<Token 'emphasis' at 296:304 (Keyword)>
 │  │  │  ├╴<Token '>' at 304:305 (Delimiter)>
 │  │  │  ├╴<Context DocBook.tag at 305-326 (4 children)>
 │  │  │  │  ├╴<Token 'splendidly' at 305:315 (Text)>
 │  │  │  │  ├╴<Token '</' at 315:317 (Delimiter)>
 │  │  │  │  ├╴<Token 'emphasis' at 317:325 (Keyword)>
 │  │  │  │  ╰╴<Token '>' at 325:326 (Delimiter)>
 │  │  │  ├╴<Token '!' at 326:327 (Text)>
 │  │  │  ├╴<Token '</' at 327:329 (Delimiter)>
 │  │  │  ├╴<Token 'para' at 329:333 (Keyword)>
 │  │  │  ╰╴<Token '>' at 333:334 (Delimiter)>
 │  │  ├╴<Token '\n   ' at 334:338 (Whitespace)>
 │  │  ├╴<Token '</' at 338:340 (Delimiter)>
 │  │  ├╴<Token 'chapter' at 340:347 (Keyword)>
 │  │  ╰╴<Token '>' at 347:348 (Delimiter)>
 │  ├╴<Token '\n   ' at 348:352 (Whitespace)>
 │  ├╴<Token '<' at 352:353 (Delimiter)>
 │  ├╴<Token 'chapter' at 353:360 (Keyword)>
 │  ├╴<Context DocBook.attrs at 361-380 (5 children)>
 │  │  ├╴<Token 'xml:id' at 361:367 (Name.Attribute)>
 │  │  ├╴<Token '=' at 367:368 (Delimiter.Operator)>
 │  │  ├╴<Token '"' at 368:369 (Literal.String.Double.Start)>
 │  │  ├╴<Context DocBook.dqstring at 369-379 (2 children)>
 │  │  │  ├╴<Token 'chapter_2' at 369:378 (Literal.String.Double)>
 │  │  │  ╰╴<Token '"' at 378:379 (Literal.String.Double.End)>
 │  │  ╰╴<Token '>' at 379:380 (Delimiter)>
 │  ├╴<Context DocBook.tag at 380-462 (14 children)>
 │  │  ├╴<Token '\n     ' at 380:386 (Whitespace)>
 │  │  ├╴<Token '<' at 386:387 (Delimiter)>
 │  │  ├╴<Token 'title' at 387:392 (Keyword)>
 │  │  ├╴<Token '>' at 392:393 (Delimiter)>
 │  │  ├╴<Context DocBook.tag at 393-410 (4 children)>
 │  │  │  ├╴<Token 'Chapter 2' at 393:402 (Text)>
 │  │  │  ├╴<Token '</' at 402:404 (Delimiter)>
 │  │  │  ├╴<Token 'title' at 404:409 (Keyword)>
 │  │  │  ╰╴<Token '>' at 409:410 (Delimiter)>
 │  │  ├╴<Token '\n     ' at 410:416 (Whitespace)>
 │  │  ├╴<Token '<' at 416:417 (Delimiter)>
 │  │  ├╴<Token 'para' at 417:421 (Keyword)>
 │  │  ├╴<Token '>' at 421:422 (Delimiter)>
 │  │  ├╴<Context DocBook.tag at 422-448 (4 children)>
 │  │  │  ├╴<Token 'Hello again, world!' at 422:441 (Text)>
 │  │  │  ├╴<Token '</' at 441:443 (Delimiter)>
 │  │  │  ├╴<Token 'para' at 443:447 (Keyword)>
 │  │  │  ╰╴<Token '>' at 447:448 (Delimiter)>
 │  │  ├╴<Token '\n   ' at 448:452 (Whitespace)>
 │  │  ├╴<Token '</' at 452:454 (Delimiter)>
 │  │  ├╴<Token 'chapter' at 454:461 (Keyword)>
 │  │  ╰╴<Token '>' at 461:462 (Delimiter)>
 │  ├╴<Token '\n ' at 462:464 (Whitespace)>
 │  ├╴<Token '</' at 464:466 (Delimiter)>
 │  ├╴<Token 'book' at 466:470 (Keyword)>
 │  ╰╴<Token '>' at 470:471 (Delimiter)>
 ╰╴<Token '\n' at 471:472 (Whitespace)>