2 namespace TYPO3\CMS\Extensionmanager\Utility\Parser;
45 $this->requiredPhpExtensions =
'xml';
55 $this->objXml = xml_parser_create();
56 xml_set_object($this->objXml, $this);
69 if (!is_resource($this->objXml)) {
70 throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(
'Unable to create XML parser.', 1342640663);
73 xml_parser_set_option($this->objXml, XML_OPTION_CASE_FOLDING,
false);
74 xml_parser_set_option($this->objXml, XML_OPTION_SKIP_WHITE,
false);
75 xml_parser_set_option($this->objXml, XML_OPTION_TARGET_ENCODING,
'utf-8');
76 xml_set_element_handler($this->objXml,
'startElement',
'endElement');
77 xml_set_character_data_handler($this->objXml,
'characterData');
78 if (!($fp = fopen($file,
'r'))) {
79 throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(sprintf(
'Unable to open file resource %s.', $file), 1342640689);
81 while ($data = fread($fp, 4096)) {
82 if (!xml_parse($this->objXml, $data, feof($fp))) {
83 throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(sprintf(
'XML error %s in line %u of file resource %s.', xml_error_string(xml_get_error_code($this->objXml)), xml_get_current_line_number($this->objXml), $file), 1342640703);
86 xml_parser_free($this->objXml);
99 switch ($elementName) {
101 $this->extensionKey = $attrs[
'extensionkey'];
104 $this->version = $attrs[
'version'];
107 $this->element = $elementName;
120 switch ($elementName) {
129 $this->element = null;
142 if (isset($this->element)) {
143 switch ($this->element) {
144 case 'downloadcounter':
147 if ($this->version == null) {
148 $this->extensionDownloadCounter = $data;
150 $this->versionDownloadCounter = $data;
154 $this->title = $data;
157 $this->description = $data;
160 $this->state = $data;
163 $this->reviewstate = $data;
166 $this->category = $data;
168 case 'lastuploaddate':
169 $this->lastuploaddate = $data;
171 case 'uploadcomment':
172 $this->uploadcomment = $data;
178 $this->authorname = $data;
181 $this->authoremail = $data;
183 case 'authorcompany':
184 $this->authorcompany = $data;
186 case 'ownerusername':
187 $this->ownerusername = $data;
190 $this->t3xfilemd5 = $data;