You are here

function XMLParser::Parse in Asset 6

Same name in this branch
  1. 6 asset_youtube/xmlparser.class.php \XMLParser::Parse()
  2. 6 asset_youtube/inc/xmlparser.class.php \XMLParser::Parse()
Same name and namespace in other branches
  1. 5 asset_youtube/xmlparser.class.php \XMLParser::Parse()

Initiates and runs PHP's XML parser

File

asset_youtube/inc/xmlparser.class.php, line 75

Class

XMLParser
XML Parser Class (php4)

Code

function Parse() {

  //Create the parser resource
  $this->parser = xml_parser_create();

  //Set the handlers
  xml_set_object($this->parser, $this);
  xml_set_element_handler($this->parser, 'StartElement', 'EndElement');
  xml_set_character_data_handler($this->parser, 'CharacterData');

  //Error handling
  if (!xml_parse($this->parser, $this->xml)) {
    $this
      ->HandleError(xml_get_error_code($this->parser), xml_get_current_line_number($this->parser), xml_get_current_column_number($this->parser));
  }

  //Free the parser
  xml_parser_free($this->parser);
}