Produce graphical images of the structure of XML Schema files


This plugin produces a graphical depiction of the data structure defined by an XML Schema (XSD) file.

Input files can be source files in an SVN repository, attachments to tickets or placed in the Trac server file system.

Output is as indicated in this example:

Example plot from V1.1

The plugin contains code allowing it to be called from a command line / a script.

Bugs/Feature Requests

Existing bugs and feature requests for TracXsdPlotMacro are here.

If you have any issues, create a new ticket.


0 / 1


4 / 6


1 / 1


Download the zipped source from here.


You can check out TracXsdPlotMacro from here using Subversion, or browse the source with Trac.


General instructions on installing Trac plugins can be found on the TracPlugins page.


  • ImageMagick must be installed.
  • ElementTree must be installed for XSD parsing.

Enable the plugin as follows in your trac.ini file:

tracxsdplot.* = enabled

Tested with Trac 1.0.6 and 1.0.15 on Linux. Older Trac versions cannot access specific source file revisions.


file.prepath = /relative/entry/directory
file.preurl =
png-density = 600
colour.element = #D3D3D3
colour.complextype = #B3B3B3
colour.container = #FFFFFF
colour.stroke = #2F4F4F

The trac.ini attributes have the following meaning:

file.prepath Path prefix for local files
file.preurl URL prefix
png-density pixel density for generated PNG images (used as parameter to ImageMagick)
colour.element RGB colour used for <xs:element>
colour.complextype ... for <xs:complexType>
colour.container ... for <xs:sequence>, <xs:all>, <xs:choice>
colour.stroke ... for box frames

The plugin contains functionality that allows command-line usage as well:

$ /path/to/plugin/xsd2svg XSDFILE --outfile=OUTFILE


[[XsdPlot(schema.xsd,width=400,page=100,caption="Page 100 from Book Example")]]
[[XsdPlot(source:repo/schema.xsd@10,width=600,caption="SVG-image from repository in version 10")]]

Possible Trac links for input files/resources

Trac link Alternatives Comment
wiki: JustPageName Wiki page attachment
ticket: #1 Ticket attachment
source: browser,repos File stored in Subversion
file: Local file. Path prefix read from file.prepath in trac.ini

XSD layout selectiveness control parameters

Parameter Value Default
top-element select specific top XSD element of plot Assumes file to contain exactly one XSD root element. Otherwise the first element encountered will be plotted.
depth maximum depth counted in elements infinity
stop-list pipe-separated list of XSD element names where recursive descent shall stop empty

Other parameters

Parameter Value Default Note
img-type 'png' or 'svg' svg Case insensitive
width width in pixel 600 Must be absolute value
caption caption under image none
label anchor to link to
cache build once or each time True Time consumption or changing vector graphics
align left|right nothing

Recent Changes

15672 by thenor on 2016-07-27 08:24:33
fix #12585, #12586, #12669, #12783. Bump version to 1.1
14868 by thenor on 2015-08-10 20:45:16
Fix 12475: Added 3-clause BSD licence and other metadata according to DevGuide
14866 by thenor on 2015-08-10 14:21:13
initial, primitive version


Author: thenor
Maintainer: Theodor Norup


Thanks to ursaw for most of the macro argument parsing and Trac infrastructure that is taken from PdfImagePlugin.

Last modified 5 months ago Last modified on Jun 24, 2018, 8:20:04 PM

Attachments (2)

Download all attachments as: .zip