Jez Higgins

Freelance software generalist
software created
extended or repaired


Older posts are available in the archive or through tags.

Feed

Follow me on Twitter
My code on GitHub

Contact
About

Tuesday 06 January 2004 Arabica

Been using Arabica for some real work recently, which isn't something that I've done for a while. The project I'm working on at the moment is a guided help & how-to system for a printer manufacturer. People install the application, and it tell them how to print business cards properly, or about different types of paper, or whatever. The help sequences come up a page at a time with Next/Previous buttons, a bit like a Windows wizard. They can also have multiple paths, so you could say, for instance if your running Word or PowerPoint and you'll be guided appropriately.

The help sequences are stored as XPDL instances. XPDL is an XML application for describing workflows, which is about as much as you really need to know. We're subverting it slightly for our purposes I suppose, but it works very well. It saved us the trouble of designing our own format, which is always harder than you think it will be. There are some reasonable-ish tools for defining the workflows too, which also saved us a lot of time.

Recently our client wanted to extend the help sequences to include screenshots. XPDL is arbitrarily extensible via its ExtendedAttribute elements, into which you can put whatever you like. The editor stashes its layout info in there, for instance. I decided to Base64 encode the images and pop them into an ExtendedAttribute, so that the images and the text they go with are all contained in the same package. Carole laboriously captured all the screenshots, and annotated the text to indicate which image went where. All we had to do now was get the data into the XPDL.

I wrote a small SAX filter to do the job. When we read a Description element, it checks the text it contains. If the text has a {{image:something.gif}} sequence, then everything kicks off. After the Description element comes an ExtendedAttributes element, into which it adds a new ExtendedAttribute element. It reads something.gif to a string, using oconvert_adaptor to Base64 encode the data. The encoded image data then becomes the ExtendedAttribute's content. Bingo - image data in the right place, without a lot of labrious manual labour. Sitting on top of that filter is SAX/filter/Writer, which properly formats the modified document and writes it out to disk.

Using a simple makefile, the workflow XPDL documents can now be rebuilt whenever the source XPDL is modified, or new images are added. Carole can write new help sequences or grab more screenshots (and there are a load of those left to do), check them into CVS and they'll get incorporated straight into the build.

Putting all this together took only an hour or two, and the source code runs to 260 lines including blanks and comments. Who said C++ was hard :) ?


Tagged code, arabica, xml, and c++


Jez Higgins

Freelance software generalist
software created
extended or repaired

Older posts are available in the archive or through tags.

Feed

Follow me on Twitter
My code on GitHub

Contact
About