More for the ongoing series of producing an XFDL viewer in Linux. In the previous tutorial, we decompressed an XFDL file, although I have had trouble recompressing the file. It turns out that I need to do some experimentation and find the exact compression method used in gzip to be able to make the form readable. That will be for the next update though. I thought I would give a short preview of what’s next on this.
An XFDL file is an XML (xform) by IBM meant to run through their interpreter. IBM has some great documentation on this format. PureEdge works much like a browser does to decompress the file by Mime-type and to then parse and read the file, including embedded binaries (for pictures, files, etc) and embedded coding (custom functions). My interpreter will have a long ways to go so I’ll be happy to just be able to place my values in the correct fields. I’m re-reading XML parsing within Python to make this an easy function, so be patient on that part. But for those eager to see what I’m talking about, I’ve pasted a small section of XML from a decompressed XFDL.
<field sid="NAME"> <itemlocation> <ae> <ae>absolute</ae> <ae>9</ae> <ae>448</ae> </ae> <ae> <ae>extent</ae> <ae>461</ae> <ae>24</ae> </ae> </itemlocation> <value></value> <borderwidth>0</borderwidth> <scrollhoriz>wordwrap</scrollhoriz> <scrollvert>fixed</scrollvert> <fontinfo> <ae>Times New Roman</ae> <ae>10</ae> <ae>plain</ae> </fontinfo> <format> <ae>string</ae> <ae>optional</ae> </format> <previous>NAME</previous> <next>GRADE</next> <acclabel>d ay form 46 44-r, december 19 82. ay p d. p e version 1.00. edition of 1 august 19 77 is obsolete. army reserve reenlistment data. for use of this form, see ay r 1 40-1 11, the proponent agency is r c p ay c. item 1. enter name using last name comma first name comma middle initial format.</acclabel> </field>As you can see, there is a <value> tag for these nodes. For my next post, I’ll write some python code to break this xml to an object that can print the label and insert a value into the xml. There is a lot of work to interpret the embedded items, code and other tags, but this will be a start!