Monthly Archives: January 2019

DB Doc 6 released

New in DB Doc 6 is improved support for PostgreSQL 11.x databases and XML output.

  • PostgreSQL 11.x databases

    There were some changes to the system tables in PostgreSQL 11, which meant DB Doc had to retrieve some object properties  from a different source.

  • XML output

    You can now generate your PostgreSQL documentation as XML files, in addition to HTML, PDF, CHM, and Word documents.
    The XML files are generated using a fully-customizable script, so you can modify the XML file to fit your requirements.  A customizable XSL stylesheet is also provided to render the XML files in your browser.

More details about DB Doc can be found here, and you can download a free 14-day trial using this link.

DB Doc 6 and XML files

New in DB Doc 6 is the option to export your PostgreSQL database schema in XML format.

We provide a script to generate the XML file, and also a sample XSL stylesheet to display the XML files in your browser.  The provided XML structure is very basic, and if you need to modify the XML structure, it’s very simple to do.

For example, let’s take a look at the XML file that’s generated for a view.

This is the script that generates the XML file for the properties section of the view.

Now let’s say you have an application that will process the XML file, and needs the ‘OID’ and ‘owner’ properties to be easily accessed.  The provided script generates these nodes as part of the ‘properties’ collection, which is great for a stylesheet, but not so easily accessed by an application that needs to read those values.

So we need to be able to generate 2 ‘types’ of XML files – one to be easily displayed, and one to be easily read.  We also don’t want to have to maintain 2 different scripts.

So first, let’s add the code to generate the ‘OID’ and ‘owner’ values in their own nodes.

At this point, our XML file will contain 2 nodes with the ‘OID’ and ‘owner’ values, like this.

We could leave it as is – our application will read the values it requires from the top-level node, while our stylesheet will read the values from the ‘properties’ collection and ignore the top-level node.

Or we could make the script leave out the redundant nodes depending on which version of the XML file we need.  We can do this using the DB Doc script user-defined values.

Let’s say the default output is to have the ‘OID’ and ‘owner’ values as part of the ‘properties’ collection.  When we want the other output, we will define a value named ‘PARSER’ as the first user-defined value.

In our script, we simply look for this user-defined value to generate the correct output.

Now every time we want to generate the XML file for our application to use, just enter the value PARSER as the first user-defined value, and DB Doc will generate the XML file accordingly.  Thus, we only need to maintain a single script file.

More details about DB Doc can be found here, and you can download a free 14-day trial using this link.