Convert DOCBOOK to PROPERTIES
Max file size 100mb.
DocBook vs Properties Format Comparison
| Aspect | DocBook (Source Format) | Properties (Target Format) |
|---|---|---|
| Format Overview |
DocBook
XML-Based Documentation Format
DocBook is an XML-based semantic markup language designed for technical documentation. Originally developed by HaL Computer Systems and O'Reilly Media in 1991, it is now maintained by OASIS. DocBook defines elements for books, articles, chapters, sections, tables, code listings, and more. It separates content from presentation. Technical Docs XML-Based |
Properties
Java Properties Configuration
Java Properties is a simple key=value configuration format used extensively in Java applications since JDK 1.0 (1996). Each line contains a key-value pair separated by = or :. The format supports comments (#), Unicode escapes, multi-line values with backslash continuation, and dotted key naming conventions for hierarchical configuration. Java Standard Key-Value |
| Technical Specifications |
Structure: XML-based semantic markup
Encoding: UTF-8 XML Standard: OASIS DocBook 5.1 Schema: RELAX NG, DTD, W3C XML Schema Extensions: .xml, .dbk, .docbook |
Structure: Line-oriented key=value pairs
Encoding: ISO 8859-1 (with Unicode escapes) API: java.util.Properties class Comments: # or ! prefix Extensions: .properties |
| Syntax Examples |
DocBook configuration documentation: <article xmlns="http://docbook.org/ns/docbook">
<title>Application Settings</title>
<section>
<title>Database Config</title>
<variablelist>
<varlistentry>
<term>db.host</term>
<listitem><para>localhost</para>
</listitem>
</varlistentry>
<varlistentry>
<term>db.port</term>
<listitem><para>5432</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</article>
|
Properties key-value output: # Application Settings # Database Config db.host=localhost db.port=5432 |
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 1991 (HaL/O'Reilly)
Current Version: DocBook 5.1 (OASIS) Status: Mature, actively maintained Evolution: SGML to XML transition in v4/v5 |
Introduced: 1996 (Java JDK 1.0)
API: java.util.Properties Status: Stable, universally used in Java Evolution: Properties to YAML/TOML alternatives |
| Software Support |
XSLT Stylesheets: DocBook XSL (Norman Walsh)
Editors: Oxygen XML, XMLmind, VS Code Processors: xsltproc, Saxon, pandoc Validators: Jing, xmllint, Schematron |
Java: java.util.Properties (native)
Spring: PropertySource, @Value Python: jproperties, configparser Editors: IntelliJ, Eclipse, VS Code |
Why Convert DocBook to Properties?
Converting DocBook to Java Properties extracts configuration data, glossary terms, and key-value pairs from structured XML documentation into the simple .properties format used by Java applications, Spring Boot, and internationalization frameworks. This is particularly useful when documentation defines configuration parameters that need to be loaded by software at runtime.
DocBook documentation frequently contains definition lists (<variablelist>) and tables that describe configuration options, environment variables, and application settings. Converting these structured descriptions to .properties format creates configuration files that Java applications can load directly using the java.util.Properties class, eliminating the need to manually transcribe settings from documentation.
The Properties format is the foundation of Java's internationalization (i18n) system. Resource bundles stored as .properties files provide localized strings for different languages and locales. When DocBook documentation contains UI text, labels, or messages, converting to Properties creates translation-ready resource bundles that follow Java's built-in localization conventions.
Spring Boot applications commonly use application.properties files for externalized configuration. DocBook documentation that describes Spring Boot settings can be converted directly to a working properties file, ensuring that documentation and configuration stay synchronized and that documented defaults match actual application behavior.
Key Benefits of Converting DocBook to Properties:
- Java Integration: Load directly with java.util.Properties class
- Spring Boot Ready: Use as application.properties configuration
- i18n Support: Create localization resource bundles from documentation
- Config Sync: Keep documentation and configuration files aligned
- Simple Format: Easy to read, edit, and manage by any developer
- Build Tool Support: Compatible with Maven, Gradle, and Ant
- Environment Overrides: Create per-environment configuration files
Practical Examples
Example 1: Configuration Reference
Input DocBook file (config.xml):
<section xmlns="http://docbook.org/ns/docbook">
<title>Server Configuration</title>
<variablelist>
<varlistentry>
<term>server.host</term>
<listitem><para>0.0.0.0</para></listitem>
</varlistentry>
<varlistentry>
<term>server.port</term>
<listitem><para>8080</para></listitem>
</varlistentry>
<varlistentry>
<term>server.ssl.enabled</term>
<listitem><para>true</para></listitem>
</varlistentry>
</variablelist>
</section>
Output Properties file (config.properties):
# Server Configuration server.host=0.0.0.0 server.port=8080 server.ssl.enabled=true
Example 2: Localization Strings
Input DocBook file (ui-labels.xml):
<section xmlns="http://docbook.org/ns/docbook">
<title>UI Labels</title>
<variablelist>
<varlistentry>
<term>label.welcome</term>
<listitem><para>Welcome to our application</para></listitem>
</varlistentry>
<varlistentry>
<term>label.login</term>
<listitem><para>Sign In</para></listitem>
</varlistentry>
<varlistentry>
<term>label.logout</term>
<listitem><para>Sign Out</para></listitem>
</varlistentry>
</variablelist>
</section>
Output Properties file (messages.properties):
# UI Labels label.welcome=Welcome to our application label.login=Sign In label.logout=Sign Out
Example 3: Database Settings from Table
Input DocBook file (database.xml):
<section xmlns="http://docbook.org/ns/docbook">
<title>Database Settings</title>
<table>
<tgroup cols="2">
<thead><row>
<entry>Property</entry>
<entry>Value</entry>
</row></thead>
<tbody>
<row><entry>spring.datasource.url</entry>
<entry>jdbc:postgresql://localhost/mydb</entry></row>
<row><entry>spring.datasource.username</entry>
<entry>admin</entry></row>
<row><entry>spring.jpa.hibernate.ddl-auto</entry>
<entry>update</entry></row>
</tbody>
</tgroup>
</table>
</section>
Output Properties file (application.properties):
# Database Settings spring.datasource.url=jdbc:postgresql://localhost/mydb spring.datasource.username=admin spring.jpa.hibernate.ddl-auto=update
Frequently Asked Questions (FAQ)
Q: How does the converter extract key-value pairs from DocBook?
A: The converter extracts key-value pairs from DocBook <variablelist> elements (where <term> is the key and <listitem> is the value), tables with key/value columns, and definition lists. Section titles become comment headers to group related properties.
Q: Can I use the output as a Spring Boot application.properties?
A: Yes, if the DocBook source documents Spring Boot configuration properties. The output uses the dotted key notation (spring.datasource.url) that Spring Boot expects. You can place the file in src/main/resources/ and Spring Boot will load it automatically.
Q: How are special characters handled?
A: The Properties format uses ISO 8859-1 encoding. Non-Latin characters are stored as Unicode escape sequences (\uXXXX). The converter handles this automatically, ensuring that international characters from DocBook documents are properly encoded in the properties output.
Q: Are comments preserved from DocBook?
A: Section titles and descriptive paragraphs from DocBook are converted to # comment lines above their respective property groups. This provides context for each group of settings, making the properties file self-documenting.
Q: Can I use this for Java resource bundle localization?
A: Yes. If the DocBook document defines UI labels, messages, or translatable strings, the conversion produces a .properties file that serves as a resource bundle. Create locale-specific versions (messages_fr.properties, messages_de.properties) for internationalization.
Q: How are hierarchical sections represented?
A: DocBook's nested section hierarchy is represented using dotted key conventions in the properties file. A section titled "Database" with a subsection "Connection Pool" produces keys like database.connectionPool.maxSize. Comment lines separate logical groups.
Q: What if the DocBook content is not key-value data?
A: For narrative documentation that does not contain structured key-value pairs, the converter extracts content as descriptive properties with generated keys based on section headings. The result may require manual review and refinement to match your application's expected property names.
Q: Can I convert properties back to DocBook?
A: Yes, reverse conversion is supported. Properties files are converted to DocBook <variablelist> elements where keys become <term> entries and values become <listitem> content. Comment lines are converted to section titles. This enables round-trip editing between documentation and configuration.