How to validate dxf files

[Dhis2-devs] dxf format
Bob Jolliffe
Wed, 10 Jun 2009 10:03:03 -0700

I've just finished a few crazy hours coding a schema to describe the
current dxf format (see attached dxf.rng file).  No invention - just
describing what's there.

I have used the RelaxNG schema language (http://www.relaxng.org/ ) to
do this because it is nicer than W3C XML Schema and easier to write
without pointy-clickety tools getting in the way :-).

Nevertheless I have also attached auto-translated relaxNG compact
format (.rnc) and W3C Schema (.xsd) versions.  The .rng file should be
considered the normative "source code" version.  It is hand-crafted
rather than auto-inferred.  There are still a few pieces to fill in
but it "works" on the few samples I have.

You can use the schema to validate dxf files you might have.  For
example using jing (http://www.thaiopensource.com/relaxng/jing.html ):

java -jar /home/bobj/java/jing-20081028/bin/jing.jar dxf.rng Export.xml

Or use the .rnc or .xsd files in an xml editing environment which
supports them.  You do need to extract the Export.xml file from the
zip first.

The process of writing the schema has exposed a whole bunch of
interesting issues which I will start to address shortly.  But for the
moment I'm sharing this as useful work in progress.  Its the first
step toward being able to interoperate nicely with others (there are
quite a few other steps ...).  When people ask what our file format is
we can at least now point to the schema.

Will stick this stuff on launchpad tomorrow.

Regards
Bob

dxf.rng [L1 ]

dxf.rnc [L2 ]

dxf.xsd [L3 ]