You are here

function JSimpleXML::__construct in Ubercart 5

Constructor.

@access protected

File

uc_store/includes/simplexml.php, line 132

Class

JSimpleXML
SimpleXML implementation.

Code

function __construct($options = null) {
  if (!function_exists('xml_parser_create')) {
    return false;

    //TODO throw warning
  }

  //Create the parser resource and make sure both versions of PHP autodetect the format.
  $this->_parser = xml_parser_create('');

  // check parser resource
  xml_set_object($this->_parser, $this);
  xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, 0);
  if (is_array($options)) {
    foreach ($options as $option => $value) {
      xml_parser_set_option($this->_parser, $option, $value);
    }
  }

  //Set the handlers
  xml_set_element_handler($this->_parser, '_startElement', '_endElement');
  xml_set_character_data_handler($this->_parser, '_characterData');
}