mirror of
https://github.com/mbirth/tcl_update_db.git
synced 2024-12-26 04:24:07 +00:00
Small fixes and optimisations in parsing.
This commit is contained in:
parent
304dc11190
commit
d90eed75f0
@ -17,10 +17,7 @@ class GotuObject
|
||||
return false;
|
||||
}
|
||||
$g = new self();
|
||||
$g->attrs['type'] = $xp->getAttr('type');
|
||||
$g->attrs['fv'] = $xp->getAttr('fv');
|
||||
$g->attrs['tv'] = $xp->getAttr('tv');
|
||||
$g->attrs['time'] = $xp->getReleaseTime();
|
||||
$g->attrs = $xp->getAttrs();
|
||||
return $g;
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ class XmlParser
|
||||
'publisher' => '//VERSION/RELEASE_INFO/publisher',
|
||||
'fw_id' => '//FIRMWARE/FW_ID',
|
||||
'fileset_count' => '//FIRMWARE/FILESET_COUNT',
|
||||
'filename' => '//FILESET/FILE[0]/FILENAME',
|
||||
'file_id' => '//FILESET/FILE[0]/FILE_ID',
|
||||
'file_size' => '//FILESET/FILE[0]/SIZE',
|
||||
'file_chksum' => '//FILESET/FILE[0]/CHECKSUM',
|
||||
'file_version' => '//FILESET/FILE[0]/FILE_VERSION',
|
||||
'filename' => '//FILESET/FILE[1]/FILENAME',
|
||||
'file_id' => '//FILESET/FILE[1]/FILE_ID',
|
||||
'file_size' => '//FILESET/FILE[1]/SIZE',
|
||||
'file_chksum' => '//FILESET/FILE[1]/CHECKSUM',
|
||||
'file_version' => '//FILESET/FILE[1]/FILE_VERSION',
|
||||
'description_en' => '//DESCRIPTION/en',
|
||||
'description_ja' => '//DESCRIPTION/ja',
|
||||
'description_zh' => '//DESCRIPTION/zh',
|
||||
@ -60,6 +60,16 @@ class XmlParser
|
||||
return $node;
|
||||
}
|
||||
|
||||
public function getAttrs()
|
||||
{
|
||||
$attrs = array();
|
||||
foreach ($this->attr_map as $key => $xpath) {
|
||||
$attrs[$key] = $this->getXPathValue($xpath);
|
||||
}
|
||||
$attrs['time'] = $this->getReleaseTime();
|
||||
return $attrs;
|
||||
}
|
||||
|
||||
public function getReleaseTime()
|
||||
{
|
||||
$yr = $this->getXPathValue('//VERSION/RELEASE_INFO/year');
|
||||
|
Loading…
Reference in New Issue
Block a user