It is done! The XFDL Loader is completed and it is functional. It came down to the wire, with less than an hour left in submission time to complete but it did get done. Here is a sample XFDL form and a sample CSV data file(RIGHT CLICK BOTH TO SAVE) to use. The process to use the web application is (each step is a different page):
Load the two sample files by file type.
Set up data to merge to the form.
Use the drop down box on the right to select data by the header
Write data in the middle column input boxes to have default data for all forms.
It’ll take awhile to generate the forms, be patient. When completed, there will be a link to download a zipped archive of your forms.
And that’s it. Be aware, because the project changed from PHP to Python, we had 10 days to generate the web application. Therefore, there is no styling (it’s not pretty) and it might not work on all forms. Also, it only selects text inputs. Check boxes, more options, etc are yet to come, but this was needed to be functional by May 15th, and with only minutes to spare, it was done!
I used to think of myself as a decent coder, but this XFDL project is a monster. Particularly with the parsing schemes. Let alone the May 15th suspense on the project!! Oh well, if it doesn’t get done, I’m still working on it… So I broke apart the XML and just to give a taste of the parsing for this, here’s my notes:
Mind you, I’m skipping the globals but here what needs to be parsed from there:
This first block is the “field” form. This is the main part to parse because this is where all values except checks and signatures will go.
<field sid="TO"> --> sid == div id
<ae>absolute</ae> -- style='position:absolute'
<ae>extent</ae> -- dimensions
<value>THIS IS WHAT NEEDS EDITTING!</value> - input, no border
<broderwidth>0</broderwidth> --> style
<fontinfo> --> style
<justify>center</justify> --> style
<next>TO</next> -> form taborder
<previous>DATE_A</previous> -> form taborder
<ae>string</ae> --> set form input type
<ae>optional</ae> --> validation check
Next part, check boxes. Nothing too scary here. Much the same as above.
<check sid=""> same
Here we get complicated. Nothing bad about the labels, except there form uses labels for definitions at the end and you’ll see it later where it is reused for a new purpose. This could pose a good challenge!
<label sid=""> same
Lines, not too bad… will just be a simple parsing the xml to putting them on the page.
<line sid=""> same
Buttons! These would be easy but they will associate with signatures.
<button sid=""> same
<value compute="">FROM CERT</value>
<ae>LOCK BINDS</ae> -- USE FOR VALIDATION
Not even touching signatures until I get the parsing scheme in place!
WILL DO LATER
Data will be easy enough, just needs to be decoded and displayed. Whew… may need to save the files to the server to display but I think HTML can handle an image from data.
The scope of the “Apps 4 the Army” competition that I am making my XFDL Viewer for is to use web apps. So I did a quick change to PHP and read up and got a framework setup. The idea is to be able to import the XFDL file and then parse the resulting XML to input values, either on a single form or by batch through an uploaded database.
The framework is complete and I’m pretty happy with the results as I’ve done much more application programming than web development, but PHP isn’t too bad. After getting the frame work together, I started to work on parsing. I mistakenly uploaded a XFDL file rather than the decompressed XML and I found something remarkable. PHP’s SimpleXML apparently can decompress the XFDL file!! This takes out a very complicated step of my project!!! I’m still working to figure out why the recompression does not produce the same output but that may not be a problem with the web interface. Stay tuned for more updates.
Programming concepts and ideas in convienant discussion and code snippets.