Usability - Productivity - Business - The web - Singapore & Twins

DXLMagic - using the DesignExtractor

I'll show you to take full advantage of the DXLMagic Tools one post at a time. You have exported your database application using the DesignExporter. Now you can run reports, transform the XML, edit it etc. When you are planning to work on individual element using the full DXL is a bit cumbersome, especially when you plan to write back just some parts of it later on. To split your file into multiple files you use the DesignExtractor. It will extract parts of your DXL based on an XPath expression. If XPath is still a mystery for you, this would be the time for a tutorial, Jeni's Introduction or Michael's Reference . Since you typically want to extract more than one sort of element, DesignExtractor uses a command file with instructions.
The syntax for DesignExtractor is:
java com.ibm.sg.dxlmagic.DesignExtractor [PathToDXL] [ResultPath] [CommandFile]
In the latest version of the DXLMagic.jar I have updated the path parameter, so you now can use "." for the current directory instead of specifying absolute path names. [PathToDXL] must point to a DXL File. I currently don't process all DXL files in one directory (Maybe I should think about such an option), so you have to point it to one DXL file. [ResultPath] is where your individual files go. You will see in a second, that you can specify subdirectories for individual results. The interesting part is the command file. The command file executes one extraction per line (empty lines or line with # at the beginning are ignored) and needs 3 parameters:
  1. File Prefix: The extractor tries to name the file using a name or alias found in the result from the XPath expression. If it can't find something it uses a running number. It appends this to the file prefix. If your file prefix contains a directory separator it will write that file into that subdirectory (and create it if needed). So the full name for any file is composed out of [ResultPath]+[File Prefix]+[Name that the Extractor figured out]. A typical value for File Prefix would be "forms/form"
  2. Export Mode: The extractor can write the result of the XPath expression into one summary file or into one file each for every result node. If you want one summary file you use "summary", for individual files use "single".
  3. XPath expression: The heart of the extractor. An XPath expression is evaluated and returns a note-set. You can do whatever you fancy including using the extractor against other XML files (you might struggle with the name spaces a little bit then). To make your live easier with the XPath, the DXL namespace is abbreviated "d:". Typically you would extract high level elements like forms, views, libraries, agents etc.. However you are not limited to that. You could e.g. extract all fields to feed them into a cross-reference system. Getting started is easy: Extracting all views is this expression "/d:/database/d:view".
The command file you typically will want to use looks like this:
Happy extracting. I'll continue that series with some of the stylesheets we have written. Stylesheets are not only good for reports, but also to whip your code into shape. Stay tuned.

Posted by on 11 April 2009 | Comments (0) | categories: DXLMagic Lotusphere Show-N-Tell Thursday


  1. No comments yet, be the first to comment