• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xml_parser_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xml_parser_free函数的典型用法代码示例。如果您正苦于以下问题:PHP xml_parser_free函数的具体用法?PHP xml_parser_free怎么用?PHP xml_parser_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xml_parser_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: parse

 public function parse($xml_or_arr)
 {
     if (is_array($xml_or_arr)) {
         $output = array();
         foreach ($xml_or_arr as $val) {
             $to = $this->parse($val);
             $output = array_merge($output, $to);
         }
         return $output;
     }
     //		echo '<h1>xml in parser:</h1><pre>'; print_r($xml); echo '</pre>';
     // if we don't start with a processing instruction,
     // we add an outer node just to ensure it's a valid xml document
     // (i.e. only a single root node)
     if (substr($xml_or_arr, 0, 2) != '<?') {
         $xml_or_arr = "<{$this->insertedNode}>" . $xml_or_arr . "</{$this->insertedNode}>";
     }
     $this->parser = xml_parser_create();
     xml_set_object($this->parser, $this);
     xml_set_element_handler($this->parser, "tagOpen", "tagClosed");
     xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
     xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
     xml_set_character_data_handler($this->parser, "tagData");
     $this->xmldata = xml_parse($this->parser, $xml_or_arr);
     if (!$this->xmldata) {
         die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser)));
     }
     xml_parser_free($this->parser);
     $this->parseCompleted();
     return $this->output;
 }
开发者ID:ilri,项目名称:genebank-gg_server,代码行数:31,代码来源:parsers.php


示例2: get_xml_tree

 /**
  * 获取xml树
  * @param string $xmldata xml数据
  * @param array $result xml内容
  */
 static function get_xml_tree($xmldata, &$result)
 {
     ini_set('track_errors', '1');
     $xmlreaderror = false;
     $parser = xml_parser_create();
     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
     if (!xml_parse_into_struct($parser, $xmldata, $vals, $index)) {
         $xmlreaderror = true;
         return 0;
     }
     xml_parser_free($parser);
     if (!$xmlreaderror) {
         $result = array();
         $i = 0;
         if (isset($vals[$i]['attributes'])) {
             foreach (array_keys($vals[$i]['attributes']) as $attkey) {
                 $attributes[$attkey] = $vals[$i]['attributes'][$attkey];
             }
         }
         $result[$vals[$i]['tag']] = array_merge((array) $attributes, self::get_children($vals, $i, 'open'));
     }
     ini_set('track_errors', '0');
     return 1;
 }
开发者ID:jianchengdu,项目名称:dangjia,代码行数:30,代码来源:XmlTool.php


示例3: _loadTranslationData

 /**
  * Load translation data (TBX file reader)
  *
  * @param  string  $filename  TBX file to add, full path must be given for access
  * @param  string  $locale    Locale has no effect for TBX because TBX defines all languages within
  *                            the source file
  * @param  array   $option    OPTIONAL Options to use
  * @throws Zend_Translation_Exception
  * @return array
  */
 protected function _loadTranslationData($filename, $locale, array $options = array())
 {
     $this->_data = array();
     if (!is_readable($filename)) {
         require_once 'Zend/Translate/Exception.php';
         throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.');
     }
     $encoding = $this->_findEncoding($filename);
     $this->_file = xml_parser_create($encoding);
     xml_set_object($this->_file, $this);
     xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0);
     xml_set_element_handler($this->_file, "_startElement", "_endElement");
     xml_set_character_data_handler($this->_file, "_contentElement");
     try {
         Zend_Xml_Security::scanFile($filename);
     } catch (Zend_Xml_Exception $e) {
         require_once 'Zend/Translate/Exception.php';
         throw new Zend_Translate_Exception($e->getMessage());
     }
     if (!xml_parse($this->_file, file_get_contents($filename))) {
         $ex = sprintf('XML error: %s at line %d of file %s', xml_error_string(xml_get_error_code($this->_file)), xml_get_current_line_number($this->_file), $filename);
         xml_parser_free($this->_file);
         require_once 'Zend/Translate/Exception.php';
         throw new Zend_Translate_Exception($ex);
     }
     return $this->_data;
 }
开发者ID:conectapb,项目名称:sysagroweb,代码行数:37,代码来源:Tbx.php


示例4: MagpieRSS

 function MagpieRSS($source)
 {
     # if PHP xml isn't compiled in, die
     #
     if (!function_exists('xml_parser_create')) {
         trigger_error("Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php");
     }
     $parser = @xml_parser_create();
     if (!is_resource($parser)) {
         trigger_error("Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php");
     }
     $this->parser = $parser;
     # pass in parser, and a reference to this object
     # set up handlers
     #
     xml_set_object($this->parser, $this);
     xml_set_element_handler($this->parser, 'feed_start_element', 'feed_end_element');
     xml_set_character_data_handler($this->parser, 'feed_cdata');
     $status = xml_parse($this->parser, $source);
     if (!$status) {
         $errorcode = xml_get_error_code($this->parser);
         if ($errorcode != XML_ERROR_NONE) {
             $xml_error = xml_error_string($errorcode);
             $error_line = xml_get_current_line_number($this->parser);
             $error_col = xml_get_current_column_number($this->parser);
             $errormsg = "{$xml_error} at line {$error_line}, column {$error_col}";
             $this->error($errormsg);
         }
     }
     xml_parser_free($this->parser);
     $this->normalize();
 }
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:32,代码来源:rss.php


示例5: __destroy

 /**
  * Destructor
  * @return void
  */
 public function __destroy()
 {
     if ($this->parser) {
         xml_parse($this->parser, '', true);
         xml_parser_free($this->parser);
     }
 }
开发者ID:cobolbaby,项目名称:phpdaemon,代码行数:11,代码来源:XMLStream.php


示例6: reset

 function reset()
 {
     if ($this->parser) {
         xml_parser_free($this->parser);
     }
     // XML file pointer
     $this->fp = 0;
     // which data has been read?
     $this->metaDataRead = 0;
     $this->allRead = 0;
     // to maintain track of where we are inside the XML file
     $this->inXml = 0;
     $this->inData = 0;
     $this->inMeta = 0;
     $this->inSkin = 0;
     $this->inTemplate = 0;
     $this->currentName = '';
     $this->currentPartName = '';
     // character data pile
     $this->cdata = '';
     // list of skinnames and templatenames (will be array of array)
     $this->skins = array();
     $this->templates = array();
     // extra info included in the XML files (e.g. installation notes)
     $this->info = '';
     // init XML parser
     $this->parser = xml_parser_create();
     xml_set_object($this->parser, $this);
     xml_set_element_handler($this->parser, 'startElement', 'endElement');
     xml_set_character_data_handler($this->parser, 'characterData');
     xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
 }
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:32,代码来源:skinie.php


示例7: readConfig

 function readConfig($filename)
 {
     // read the xml database
     //print "FILE: $filename";
     $data = implode("", file($filename));
     $parser = xml_parser_create();
     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
     xml_parse_into_struct($parser, $data, $values, $tags);
     xml_parser_free($parser);
     // loop through the structures
     foreach ($tags as $key => $val) {
         if ($key == "node") {
             $noderanges = $val;
             // each contiguous pair of array entries are the
             // lower and upper range for each node definition
             for ($i = 0; $i < count($noderanges); $i += 2) {
                 $offset = $noderanges[$i] + 1;
                 $len = $noderanges[$i + 1] - $offset;
                 $tdb[] = $this->parseXML(array_slice($values, $offset, $len));
             }
         } else {
             continue;
         }
     }
     return $tdb;
 }
开发者ID:BackupTheBerlios,项目名称:chits-svn,代码行数:27,代码来源:class.datanode.php


示例8: parseRSS

function parseRSS($url)
{
    //PARSE RSS FEED
    $feedeed = implode('', file($url));
    $parser = xml_parser_create();
    xml_parse_into_struct($parser, $feedeed, $valueals, $index);
    xml_parser_free($parser);
    //CONSTRUCT ARRAY
    foreach ($valueals as $keyey => $valueal) {
        if ($valueal['type'] != 'cdata') {
            $item[$keyey] = $valueal;
        }
    }
    $i = 0;
    foreach ($item as $key => $value) {
        if ($value['type'] == 'open') {
            $i++;
            $itemame[$i] = $value['tag'];
        } elseif ($value['type'] == 'close') {
            $feed = $values[$i];
            $item = $itemame[$i];
            $i--;
            if (count($values[$i]) > 1) {
                $values[$i][$item][] = $feed;
            } else {
                $values[$i][$item] = $feed;
            }
        } else {
            $values[$i][$value['tag']] = $value['value'];
        }
    }
    //RETURN ARRAY VALUES
    return $values[0];
}
开发者ID:rckarchitects,项目名称:cornerstone-rcka,代码行数:34,代码来源:inc_feeds.php


示例9: parseFile

 function parseFile($fileLocation)
 {
     // reset it.
     $this->_docType = NULL;
     $this->_nameSpace = NULL;
     $this->_errors = NULL;
     $fp = @fopen($fileLocation, 'r');
     if ($fp) {
         $parser = xml_parser_create('ISO-8859-1');
         xml_set_object($parser, $this);
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, FALSE);
         xml_set_element_handler($parser, "_startElement", "_endElement");
         while ($data = fread($fp, 1024)) {
             if (strlen($this->_docType) > 0) {
                 break;
             }
             if (!xml_parse($parser, $data, feof($fp))) {
                 $error = xml_error_string(xml_get_error_code($parser));
                 break;
             }
         }
         xml_parser_free($parser);
         @fclose(fp);
         return TRUE;
     } else {
         $this->_errors[] = 'File ' . $fileLocation . ' could not be opened.';
         return FALSE;
     }
 }
开发者ID:horrabin,项目名称:opendb,代码行数:29,代码来源:DocTypeNameSpaceXMLParser.class.php


示例10: discuz

 /**
  * 使用discuz词库
  * @param unknown_type $title
  * @param unknown_type $content
  */
 public static function discuz($title = '', $content = '')
 {
     $subjectenc = rawurlencode(strip_tags($title));
     $messageenc = rawurlencode(strip_tags(preg_replace("/\\[.+?\\]/U", '', $content)));
     $data = @implode('', file("http://keyword.discuz.com/related_kw.html?title={$subjectenc}&content={$messageenc}&ics=utf-8&ocs=utf-8"));
     if ($data) {
         $parser = xml_parser_create();
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
         xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
         xml_parse_into_struct($parser, $data, $values, $index);
         xml_parser_free($parser);
         $kws = array();
         foreach ($values as $valuearray) {
             if ($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') {
                 $kws[] = trim($valuearray['value']);
             }
         }
         $return = '';
         if ($kws) {
             foreach ($kws as $kw) {
                 $kw = CHtml::encode(strip_tags($kw));
                 $return .= $dot . $kw;
                 $dot = ',';
             }
             $return = trim($return);
         }
         return $return;
     }
 }
开发者ID:zywh,项目名称:maplecity,代码行数:34,代码来源:XAutoKeyword.php


示例11: parse

 public function parse($data)
 {
     $p = xml_parser_create();
     xml_parse_into_struct($p, $data, $vals, $index);
     xml_parser_free($p);
     return $vals;
 }
开发者ID:aurora-framework,项目名称:filesystem,代码行数:7,代码来源:XML.php


示例12: analyser_XML

 /** 
  * Pour tester la validité d'un document XML, on peut utiliser un analyseur syntaxique XML : http://fr3.php.net/manual/fr/book.xml.php
  * Voir en particulier l'exemple http://fr3.php.net/manual/fr/example.xml-structure.php
  * 
  * Mais ceci ne permet pas de vérifier la conformité d'un XML avec une DTD.
  * DOMDocument le permet : http://fr2.php.net/manual/fr/domdocument.validate.php
  * Mais d'une part ça emmet des warnings et d'autre part ça ne retourne qu'un booléen sans détails sur les erreurs trouvées
  * 
  * Pour y remédier on peut utiliser cette extention de classe "MyDOMDocument" : http://fr2.php.net/manual/fr/domdocument.validate.php#85792
  * Mais attention : il faut lui fournir un objet DOMDocument et load ou loadXML provoquent des warnings préliminaires si le XML est mal formé.
  * 
  * Ma solution est d'utiliser :
  * 1. dans un premier temps l'analyseur syntaxique XML xml_parse pour vérifier que le XML est bien formé
  * 2. dans un second temps l'extention de classe MyDOMDocument pour vérifier la conformité avec la DTD
  * 
  * J'en ai fait la fonction ci-dessous "analyser_XML($fichier)".
  * La classe "MyDOMDocument" est dans autochargée (elle se trouve ici : _inc/class.domdocument.php).
  * 
  * @param string    $fichier_adresse
  * @return string   'ok' ou un message d'erreur
  */
 private static function analyser_XML($fichier_adresse)
 {
   // Récupération du contenu du fichier
   $fichier_contenu = file_get_contents($fichier_adresse);
   $fichier_contenu = To::deleteBOM(To::utf8($fichier_contenu)); // Mettre en UTF-8 si besoin et retirer le BOM éventuel
   FileSystem::ecrire_fichier($fichier_adresse,$fichier_contenu); // Mettre à jour le fichier au cas où.
   // Analyse XML (s'arrête à la 1ère erreur trouvée)
   $xml_parser = xml_parser_create();
   $valid_XML = xml_parse($xml_parser , $fichier_contenu , TRUE);
   if(!$valid_XML)
   {
     return sprintf("Erreur XML ligne %d (%s)" , xml_get_current_line_number($xml_parser) , xml_error_string(xml_get_error_code($xml_parser)));
   }
   xml_parser_free($xml_parser);
   // Analyse DTD (renvoie un tableau d'erreurs, affiche la dernière)
   $xml = new DOMDocument;
   $xml -> load($fichier_adresse);
   $xml = new MyDOMDocument($xml);
   $valid_DTD = $xml->validate();
   if(!$valid_DTD)
   {
     return 'Erreur DTD : '.end($xml->errors);
   }
   // Tout est ok
   return 'ok';
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:47,代码来源:class.ServeurCommunautaire.php


示例13: fetch

 function fetch($raw_xml, $final = true)
 {
     $this->log .= 'fetch() called.' . PHP_EOL;
     $this->log .= 'Raw XML:' . PHP_EOL . $raw_xml . PHP_EOL . PHP_EOL;
     $this->index = 0;
     $this->data = new stdClass();
     $this->stack = array();
     $this->stack[] =& $this->data;
     $this->parser = xml_parser_create('UTF-8');
     xml_set_object($this->parser, $this);
     xml_set_element_handler($this->parser, 'tag_open', 'tag_close');
     xml_set_character_data_handler($this->parser, 'cdata');
     xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
     xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
     xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
     $start = 0;
     $length = strlen($raw_xml);
     $chunk_size = 32 * 1024 * 1024;
     $ret = true;
     while (true) {
         if (!($parsed_xml = xml_parse($this->parser, substr($raw_xml, $start, $chunk_size), $final = ($start += $chunk_size) >= $length ? true : false))) {
             $this->log .= $ret = sprintf('XML error: %s at line %d.', xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser));
             break;
         } else {
             if ($final) {
                 break;
             }
         }
     }
     xml_parser_free($this->parser);
     return $ret;
 }
开发者ID:nickhype,项目名称:HackeyWalk-site-backup,代码行数:32,代码来源:xml.php


示例14: info

function info($fisbn, &$isbn10, &$isbn13, &$title, &$title_ext, &$author, &$publisher, $dump = false) {
    global $LOOKUP_URL, $LOOKUP_KEY;
    $full_url = $LOOKUP_URL . "access_key=" . $LOOKUP_KEY . "&index1=isbn&value1=" . $fisbn;
    $contents = file_get_contents($full_url);
    $parser = xml_parser_create();
    xml_parse_into_struct($parser, $contents, $values, $index);
    xml_parser_free($parser);
    $num_results = $values[$index['BOOKLIST'][0]];
    if($num_results == 0) { // bad ISBN
        return false;
    }
    $indx = $index['BOOKDATA'][0];
    $isbn10 = $values[$indx]['attributes']['ISBN'];
    $isbn13 = $values[$indx]['attributes']['ISBN13'];
    $title = $values[$index['TITLE'][0]]['value'];
    $title_ext = $values[$index['TITLELONG'][0]]['value'];
    $author = $values[$index['AUTHORSTEXT'][0]]['value'];
    $publisher = $values[$index['PUBLISHERTEXT'][0]]['value'];
    
    if(!$dump)
        return true;
    print_r($index);
    echo '<br />';
    print_r($values);
    return true;
}
开发者ID:n1ckyoung,项目名称:bellbook,代码行数:26,代码来源:lookup.php


示例15: postToEWAY

 function postToEWAY($payment_id, $url, $vars)
 {
     global $db;
     $varsx = array();
     foreach ($vars as $k => $v) {
         $varsx[] = urlencode($k) . "=" . urlencode($v);
     }
     $result = get_url($url = $url . "?" . join('&', $varsx));
     $payment = $db->get_payment($payment_id);
     $payment['data'][] = $vars;
     $payment['data'][] = array('result' => $result);
     // Simple parser
     $parser = xml_parser_create();
     xml_parse_into_struct($parser, $result, $vals, $index);
     xml_parser_free($parser);
     foreach ($index as $k => $v) {
         foreach ($v as $vv) {
             if ($vals[$vv]['value']) {
                 $ret[$k] = $vals[$vv]['value'];
             }
         }
     }
     $payment['data'][] = $ret;
     $db->update_payment($payment_id, $payment);
     return $ret;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:26,代码来源:eway_international.inc.php


示例16: parse

 function parse($xml)
 {
     $this->result = array();
     $this->context = $xml;
     $this->currentTag = '';
     $this->currentState = array();
     $this->xmlParser = xml_parser_create();
     xml_parser_set_option($this->xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8") . xml_set_object($this->xmlParser, $this);
     xml_set_element_handler($this->xmlParser, 'startElement', 'endElement');
     xml_set_character_data_handler($this->xmlParser, 'content');
     $this->trigger('before:import');
     try {
         if (!xml_parse($this->xmlParser, $xml)) {
             $this->xmlParserError = 'Line ' . xml_get_current_line_number($this->xmlParser) . ': ' . (xml_get_error_code($this->xmlParser) ? xml_error_string(xml_get_error_code($this->xmlParser)) : 'Unknown error');
         }
     } catch (Exception $e) {
         $this->xmlParserError = $e->getMessage();
     }
     xml_parser_free($this->xmlParser);
     if ($this->xmlParserError) {
         $this->raiseError($this->xmlParserError);
     } else {
         if ($this->getCurrentState()) {
             $this->raiseError('Wrong ending state: ' . $this->getCurrentState());
         } else {
         }
     }
     $this->trigger('after:import');
     return $this->result;
 }
开发者ID:jagermesh,项目名称:bright,代码行数:30,代码来源:BrXMLParser.php


示例17: __construct

 public function __construct($input, $maxDepth = 20)
 {
     if (!is_string($input)) {
         throw new XmlToArrayException('No valid input.');
     }
     $this->_maxDepth = $maxDepth;
     $XMLParser = xml_parser_create();
     xml_parser_set_option($XMLParser, XML_OPTION_SKIP_WHITE, false);
     xml_parser_set_option($XMLParser, XML_OPTION_CASE_FOLDING, false);
     xml_parser_set_option($XMLParser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
     xml_set_character_data_handler($XMLParser, array($this, '_contents'));
     xml_set_default_handler($XMLParser, array($this, '_default'));
     xml_set_element_handler($XMLParser, array($this, '_start'), array($this, '_end'));
     xml_set_external_entity_ref_handler($XMLParser, array($this, '_externalEntity'));
     xml_set_notation_decl_handler($XMLParser, array($this, '_notationDecl'));
     xml_set_processing_instruction_handler($XMLParser, array($this, '_processingInstruction'));
     xml_set_unparsed_entity_decl_handler($XMLParser, array($this, '_unparsedEntityDecl'));
     if (!xml_parse($XMLParser, $input, true)) {
         $errorCode = xml_get_error_code($XMLParser);
         $message = sprintf('%s. line: %d, char: %d' . ($this->_tagStack ? ', tag: %s' : ''), xml_error_string($errorCode), xml_get_current_line_number($XMLParser), xml_get_current_column_number($XMLParser) + 1, implode('->', $this->_tagStack));
         xml_parser_free($XMLParser);
         throw new XmlToArrayException($message, $errorCode);
     }
     xml_parser_free($XMLParser);
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:25,代码来源:xml_to_array.php


示例18: load

 function load($xml_file)
 {
     $this->_path = dirname($xml_file);
     if (!file_exists($xml_file)) {
         return;
     }
     $fp = @fopen($xml_file, "r");
     if ($fp) {
         $data = '';
         while (!feof($fp)) {
             $data .= fread($fp, 8192);
         }
         fclose($fp);
         if (ini_get("magic_quotes_gpc")) {
             $data = stripslashes($data);
         }
     }
     $this->_parser = xml_parser_create('UTF-8');
     xml_set_object($this->_parser, $this);
     xml_set_element_handler($this->_parser, "_saxStartElement", "_saxEndElement");
     xml_parser_set_option($this->_parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
     if (!xml_parse($this->_parser, $data, true)) {
         trigger_error(sprintf("Language pack loading failed, XML error: %s at line %d.", xml_error_string(xml_get_error_code($this->_parser)), xml_get_current_line_number($this->_parser)), E_USER_ERROR);
     }
     xml_parser_free($this->_parser);
 }
开发者ID:Vladimir25,项目名称:marykay,代码行数:26,代码来源:ClientResources.php


示例19: loadXML

 function loadXML($file)
 {
     $this->_parser = xml_parser_create($this->getEncoding($file));
     // Auto detect for PHP4/PHP5
     xml_set_object($this->_parser, $this);
     xml_set_element_handler($this->_parser, "_saxStartElement", "_saxEndElement");
     xml_set_character_data_handler($this->_parser, "_saxCharacterData");
     xml_parser_set_option($this->_parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
     if ($fp = fopen($file, "r")) {
         $data = '';
         while (!feof($fp)) {
             $data .= fread($fp, 8192);
         }
         fclose($fp);
         // Strip slashes
         if (ini_get("magic_quotes_gpc")) {
             $data = stripslashes($data);
         }
         // XML parse
         if (!xml_parse($this->_parser, $data, true)) {
             trigger_error(sprintf("Language pack loading failed, XML error: %s at line %d.", xml_error_string(xml_get_error_code($this->_parser)), xml_get_current_line_number($this->_parser)), FATAL);
         }
     } else {
         trigger_error("Could not open XML language pack: " . $file, FATAL);
     }
     xml_parser_free($this->_parser);
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:27,代码来源:LanguageReader.php


示例20: go

 /**
  * Run the loader, to load up field-restrictions from the XML file.
  *
  * @param  string			The default breadcrumbs
  * @param  string			The breadcrumb XML data
  */
 function go($current_breadcrumbs, $data)
 {
     $this->tag_stack = array();
     $this->attribute_stack = array();
     $this->substitution_current_match_key = NULL;
     $this->substitution_current_label = NULL;
     $this->links = array();
     $this->substitutions = array();
     $breadcrumb_tpl = do_template('BREADCRUMB_ESCAPED');
     $this->breadcrumb_tpl = $breadcrumb_tpl->evaluate();
     $this->current_breadcrumbs = $current_breadcrumbs;
     // Create and setup our parser
     $xml_parser = @xml_parser_create();
     if ($xml_parser === false) {
         return;
         // PHP5 default build on windows comes with this function disabled, so we need to be able to escape on error
     }
     xml_set_object($xml_parser, $this);
     @xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, get_charset());
     @xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
     xml_set_element_handler($xml_parser, 'startElement', 'endElement');
     xml_set_character_data_handler($xml_parser, 'startText');
     // Run the parser
     if (@xml_parse($xml_parser, $data, true) == 0) {
         attach_message('breadcrumbs.xml: ' . xml_error_string(xml_get_error_code($xml_parser)), 'warn');
         return;
     }
     @xml_parser_free($xml_parser);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:breadcrumbs.php



注:本文中的xml_parser_free函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xml_parser_get_option函数代码示例发布时间:2022-05-23
下一篇:
PHP xml_parser_create_ns函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap