wissel.net

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:
forms/form,single,/d:database/d:form
forms/subform,single,/d:database/d:subform
forms/page,single,/d:database/d:page
misc/frameset,single,/d:database/d:frameset
views/view,single,/d:database/d:view
views/folder,single,/d:database/d:folder
sharedstuff/field,single,/d:database/d:sharedfield
sharedstuff/action,single,/d:database/d:sharedactions
resources/image,single,/d:database/d:imageresource
resources/applet,single,/d:database/d:appletresource
code/agent,single,/d:database/d:agent
code/webservice,single,/d:database/d:webservice
code/scribtlibrary,single,/d:database/d:scriptlibrary
sharedstuff/column,single,/d:database/d:sharedcolumn
misc/outline,single,/d:database/d:outline
code/databasescript,single,/d:database/d:databasescript
misc/helpusingdocument,single,/d:database/d:helpusingdocument
misc/helpaboutdocument,single,/d:database/d:helpaboutdocument
resources/dataconnection,single,/d:database/d:dataconnection
resources/fileresource,single,/d:database/d:fileresource
resources/stylesheetresource,single,/d:database/d:stylesheetresource
resources/db2accessview,single,/d:database/d:db2accessview
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

Comments

  1. No comments yet, be the first to comment