Andrew E. Bruno
A sourceful of secrets

Archive for the 'XML' Category

MIF XML at O'Reilly

Sunday, February 4th, 2007

Keith, a fellow O'Reillyer, has written a few posts on how O'Reilly has been making use of MIF XML (MX). Keith gives some background and example uses as a follow up to my previous posts on converting MIF to XML. He also posted some XSLT for round-tripping the XML back into MIF.

Converting MIF to XML - Java Version

Wednesday, January 31st, 2007

In my previous post I discussed a tool called mif2xml for converting MIF files to an intermediate XML dialect. In this post I'll talk about the Java port of mif2xml called mif2xml-j which you can download here including just the executable jar or browse the source online via svn.

JFlex is a lexical analyzer generator for Java and is the library I chose to use for creating the MIF lexer. The first step was to get JFlex integrated into my build environment. For this project I decided to use ant but integrating JFlex into another build environment ...Read the rest of this entry »

Converting MIF to XML

Thursday, January 25th, 2007

MIF (Maker Interchange Format) is an ASCII text representation of a FrameMaker document. You can export your FrameMaker documents into this text based representation to allow for parsing and manipulation by external tools outside of FrameMaker. You can also import MIF files back into FrameMaker. If your interested in reading more about MIF you can check out the MIF Reference from Adobe (link may be out of date).

There's a great perl module on CPAN for working with MIF files called FrameMaker::MifTree. It's a subclass of Tree::DAG_Node and provides a nice interface for modifying the in-memory tree structure and dumping back out into MIF. The only downside to this module is that it's very slow especially with larger MIF files.

At O'Reilly we've had to work with MIF files quite a bit and have taken several different approaches for processing MIF most of which turn out to be unmaintainable scripts that are not very pleasant to work with. One of the ideas Andrew S. and Keith came up with was to convert MIF to an intermediate XML format which would allow us to process MIF using XML tools such as XSLT and XQuery. From this intermediate XML format we can transform to DocBook, WordML, or even convert back to MIF again for later importing into FrameMaker. This approach was very appealing as it can greatly reduce the number of one off scripts and allow us to benefit from the wide variety of libraries for parsing and transforming XML. ...Read the rest of this entry »