2 namespace TYPO3\CMS\Extensionmanager\Utility\Parser;
40 $this->requiredPhpExtensions =
'xml';
50 $this->objXml = xml_parser_create();
51 xml_set_object($this->objXml, $this);
64 if (!is_resource($this->objXml)) {
65 throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(
'Unable to create XML parser.', 1342641009);
68 xml_parser_set_option($this->objXml, XML_OPTION_CASE_FOLDING,
false);
69 xml_parser_set_option($this->objXml, XML_OPTION_SKIP_WHITE,
false);
70 xml_parser_set_option($this->objXml, XML_OPTION_TARGET_ENCODING,
'utf-8');
71 xml_set_element_handler($this->objXml,
'startElement',
'endElement');
72 xml_set_character_data_handler($this->objXml,
'characterData');
73 if (!($fp = fopen($file,
'r'))) {
74 throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(sprintf(
'Unable to open file resource %s.', $file), 1342641010);
76 while ($data = fread($fp, 4096)) {
77 if (!xml_parse($this->objXml, $data, feof($fp))) {
78 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), 1342641011);
81 xml_parser_free($this->objXml);
94 switch ($elementName) {
96 $this->element = $elementName;
112 switch ($elementName) {
118 $this->element = null;
134 if (isset($this->element)) {
135 switch ($this->element) {
137 $this->title = $data;
146 $this->country = $data;
149 $this->sponsorname = $data;
152 $this->sponsorlink = $data;
155 $this->sponsorlogo = $data;