12 * obtain it through the world-wide-web, please send an email |
12 * obtain it through the world-wide-web, please send an email |
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Translate |
16 * @package Zend_Translate |
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @version $Id: Xliff.php 20096 2010-01-06 02:05:09Z bkarwin $ |
18 * @version $Id: Xliff.php 24649 2012-02-26 03:37:54Z adamlundrigan $ |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 */ |
20 */ |
21 |
21 |
22 |
22 |
23 /** Zend_Locale */ |
23 /** Zend_Locale */ |
28 |
28 |
29 |
29 |
30 /** |
30 /** |
31 * @category Zend |
31 * @category Zend |
32 * @package Zend_Translate |
32 * @package Zend_Translate |
33 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
33 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
34 * @license http://framework.zend.com/license/new-bsd New BSD License |
34 * @license http://framework.zend.com/license/new-bsd New BSD License |
35 */ |
35 */ |
36 class Zend_Translate_Adapter_Xliff extends Zend_Translate_Adapter { |
36 class Zend_Translate_Adapter_Xliff extends Zend_Translate_Adapter { |
37 // Internal variables |
37 // Internal variables |
38 private $_file = false; |
38 private $_file = false; |
79 xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0); |
79 xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0); |
80 xml_set_element_handler($this->_file, "_startElement", "_endElement"); |
80 xml_set_element_handler($this->_file, "_startElement", "_endElement"); |
81 xml_set_character_data_handler($this->_file, "_contentElement"); |
81 xml_set_character_data_handler($this->_file, "_contentElement"); |
82 |
82 |
83 if (!xml_parse($this->_file, file_get_contents($filename))) { |
83 if (!xml_parse($this->_file, file_get_contents($filename))) { |
84 $ex = sprintf('XML error: %s at line %d', |
84 $ex = sprintf('XML error: %s at line %d of file %s', |
85 xml_error_string(xml_get_error_code($this->_file)), |
85 xml_error_string(xml_get_error_code($this->_file)), |
86 xml_get_current_line_number($this->_file)); |
86 xml_get_current_line_number($this->_file), |
|
87 $filename); |
87 xml_parser_free($this->_file); |
88 xml_parser_free($this->_file); |
88 require_once 'Zend/Translate/Exception.php'; |
89 require_once 'Zend/Translate/Exception.php'; |
89 throw new Zend_Translate_Exception($ex); |
90 throw new Zend_Translate_Exception($ex); |
90 } |
91 } |
91 |
92 |