Parses a WURFL XML file; either the whole file or a patch file. So long as the file validates as XML and conforms to the WURFL specification it can be parsed by this class into the necessary objects and committed to the database.
As this is an intensive process it is recommended to run the parser offline on the command line or as a detached process.
$oParser = new wurflParser("/path/to/wurfl.xml");
$oParser->process();
To make the database data more useful, a rebuild option is included. This will assign the model name and manufacturer reference to the device record. This then allows for devices to be selected by manufacturer and displayed.
public __construct([$inResource = false], [$inRebuildDeviceData = false], [$inTreatAsCustomData = false])
Returns a new wurflParser object, if $inRebuildDeviceData is true, device data is rebuilt automatically after parsing. If $inTreatAsCustomData is true, the resource is treated as containing custom data that will override the WURFL data (stored separately).
public getXml()
Returns xml
public setXml($xml)
Set xml property
public getResource()
Returns Resource
public setResource($inResource)
Set Resource property
public readResource()
Attempts to read the loaded resource which can be either a string of XML or a file location
public getRebuildDeviceData()
Returns RebuildDeviceData
public setRebuildDeviceData($inRebuildDeviceData)
Set RebuildDeviceData property
public getTreatAsCustomData()
Returns TreatAsCustomData
public setTreatAsCustomData($inTreatAsCustomData)
Set TreatAsCustomData property
public getProcessCount()
Returns $_ProcessCount
public setProcessCount($inProcessCount)
Set $_ProcessCount to $inProcessCount
protected convertVarType($var)
Casts a variable to an alternative type starting with string. Used during parsing as many variables are objects and need to be an actual variable
public process()
Processes the WURFL data into the database
public rebuildDeviceData()
Rebuilds the device data attaching missing data to the root devices
Posted by: Scorpio Documentor (Writer), in Wurfl on 19 Nov 2009 @ 20:39
Tags: wurfl, wurflparser,
This
work is licenced under a
Creative Commons Licence.