By Dave Redfern (Writer)

Published: 26 Feb 2009 @ 21:05 in Command Line Tools

The wurflParser.php is a command line tool for handling WURFL XML files. These can be either the entire resource file (which can be optionally downloaded from the WURFL project homepage) or custom patch files.

The parser will accept either a single file or a directory of files. Regardless of resource, all files MUST be valid XML and conform to the WURFL XML schema.

When running the parser, the XML files will be converted stored in the wurfl database therefore it will only work with MySQL and requires the creation of the wurfl database. Parsing should be performed in two steps: for the first time a fresh and up-to-date WURFL file should be run first to create the basic structures and ensure that all the capabilities are present and correct. This can be done by using the tool to download the latest WURFL file (-d) to the temp folder. Second, any custom data or patch files should be parsed with the optional -c switch to ensure that the data is handled as custom data. Lastly: to build the correct relationships between model and manufacturer and allow better searching the manufacturer data should be updated by using the -R switch to rebuild it.

Running the parser can take a substantial amount of time depending on the number and size of the files to process. The first pass can be particularly time-consuming as the entire WURFL database is being saved into the various tables.

As an optional step and to aid editing device profiles using the admin tools, an optional CSV file can be parsed which will set help text and variable types for the various capabilities. A CSV file is provided with Scorpio containing most of these at the time of writing. This file should be processed only after the main WURFL file has been loaded.

In keeping with other CLI tools, wurflParser.php has complete help for all options.

Return to article