1
0
mirror of https://github.com/mbirth/tcl_update_db.git synced 2024-11-09 23:06:45 +00:00

Small fixes and optimisations in parsing.

This commit is contained in:
Markus Birth 2017-11-22 00:19:44 +01:00
parent 304dc11190
commit d90eed75f0
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
2 changed files with 16 additions and 9 deletions

View File

@ -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;
}
}

View File

@ -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');