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

PHP libxml_get_errors函数代码示例

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

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



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

示例1: request

 /**
  * @param string $url
  * @param string $method
  * @param string $body
  *
  * @return FhirResponse
  */
 public function request($url, $method = 'GET', $body = null)
 {
     $server_name = null;
     foreach ($this->servers as $name => $server) {
         if (substr($url, 0, strlen($server['base_url']))) {
             $server_name = $name;
             break;
         }
     }
     $this->applyServerConfig($server_name ? $this->servers[$server_name] : array());
     $this->http_client->setUri($url);
     $this->http_client->setMethod($method);
     if ($body) {
         $this->http_client->setRawData($body, 'application/xml+fhir; charset=utf-8');
     }
     $response = $this->http_client->request();
     $this->http_client->resetParameters();
     if ($body = $response->getBody()) {
         $use_errors = libxml_use_internal_errors(true);
         $value = Yii::app()->fhirMarshal->parseXml($body);
         $errors = libxml_get_errors();
         libxml_use_internal_errors($use_errors);
         if ($errors) {
             throw new Exception("Error parsing XML response from {$method} to {$url}: " . print_r($errors, true));
         }
     } else {
         $value = null;
     }
     return new FhirResponse($response->getStatus(), $value);
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:37,代码来源:FhirClient.php


示例2: read

 /**
  * Convert string with xml data to php array.
  *
  * @throws Exception
  *
  * @param string $string
  *
  * @return array
  */
 public function read($string)
 {
     libxml_use_internal_errors(true);
     libxml_disable_entity_loader(true);
     $result = simplexml_load_string($string, null, LIBXML_IMPORT_FLAGS);
     if (!$result) {
         $errors = libxml_get_errors();
         libxml_clear_errors();
         foreach ($errors as $error) {
             $text = '';
             switch ($error->level) {
                 case LIBXML_ERR_WARNING:
                     $text .= _s('XML file contains warning %1$s:', $error->code);
                     break;
                 case LIBXML_ERR_ERROR:
                     $text .= _s('XML file contains error %1$s:', $error->code);
                     break;
                 case LIBXML_ERR_FATAL:
                     $text .= _s('XML file contains fatal error %1$s:', $error->code);
                     break;
             }
             $text .= trim($error->message) . ' [ Line: ' . $error->line . ' | Column: ' . $error->column . ' ]';
             throw new Exception($text);
         }
     }
     $xml = new XMLReader();
     $xml->xml($string);
     $array = $this->xmlToArray($xml);
     $xml->close();
     return $array;
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:40,代码来源:CXmlImportReader.php


示例3: load

 /**
  * Returns array of simple xml objects, where key is a handle name
  *
  * @return SimpleXmlElement[]
  * @throws RuntimeException in case of load error (malformed xml, etc)
  */
 public function load()
 {
     $this->validate();
     $original = libxml_use_internal_errors(true);
     $simpleXmlElement = simplexml_load_file($this->filePath);
     $errors = libxml_get_errors();
     libxml_clear_errors();
     libxml_use_internal_errors($original);
     if ($simpleXmlElement === false) {
         $messages = array();
         foreach ($errors as $error) {
             $messages[] = sprintf('%s, line %s, column %s', trim($error->message), $error->line, $error->column);
         }
         throw new RuntimeException(sprintf('File "%s" has a malformed xml structure: %s', $this->filePath, PHP_EOL . implode(PHP_EOL, $messages)));
     }
     $stringXml = array();
     // First convert all elements to string,
     // as in xml file can be multiple string with the same handle names
     foreach ($simpleXmlElement->children() as $key => $element) {
         if (!isset($stringXml[$key])) {
             $stringXml[$key] = '';
         }
         foreach ($element->children() as $child) {
             $stringXml[$key] .= $child->asXml();
         }
     }
     $result = array();
     foreach ($stringXml as $key => $xml) {
         $result[$key] = simplexml_load_string(sprintf('<%1$s>%2$s</%1$s>', $key, $xml));
     }
     return $result;
 }
开发者ID:albertobraschi,项目名称:EcomDev_LayoutCompiler,代码行数:38,代码来源:File.php


示例4: validate

		public function validate($xml,$schema) {
			// Enable user error handling
			libxml_use_internal_errors(true);

			try {
				if(empty($xml)) {
					throw new Exception("You provided an empty XML string");
				}
				
				$doc = DOMDocument::loadXML($xml);
				if(!($doc instanceof DOMDocument)){
					$this->_errors = libxml_get_errors();
				}
	
				if(!@$doc->schemaValidate($schema)){
			        $this->_errors = libxml_get_errors();
				}
			} catch (Exception $e) {
				$this->_errors = array(0 => array('message'=>$e->getMessage()));
			}

			// Disable user error handling & Error Cleanup
			libxml_use_internal_errors(false);
			libxml_clear_errors();

			// If there are no errors, assume that it is all OK!
			return empty($this->_errors);
    	}
开发者ID:remie,项目名称:schemadevkit,代码行数:28,代码来源:SchemaValidator.php


示例5: runTest

 public function runTest()
 {
     libxml_use_internal_errors(true);
     $xml = XMLReader::open(join(DIRECTORY_SEPARATOR, array($this->directory, $this->fileName)));
     $xml->setSchema(join(DIRECTORY_SEPARATOR, array($this->directory, $this->xsdFilename)));
     $this->logger->trace(__METHOD__);
     $this->logger->info('  XML file to test validity is ' . $this->fileName . 'using XSD file ' . $this->xsdFilename);
     // You have to parse the XML-file if you want it to be validated
     $currentReadCount = 1;
     $validationFailed = false;
     while ($xml->read() && $validationFailed == false) {
         // I want to break as soon as file is shown not to be valid
         // We could allow it to collect a few messages, but I think it's best
         // to do a manual check once we have discovered the file is not
         // correct. Speed is really what we want here!
         if ($currentReadCount++ % Constants::XML_PROCESSESING_CHECK_ERROR_COUNT == 0) {
             if (count(libxml_get_errors()) > 0) {
                 $validationFailed = true;
             }
         }
     }
     if (count(libxml_get_errors()) == 0) {
         $this->testProperty->addTestResult(true);
         $this->logger->info(' RESULT Validation of [' . $this->fileName . '] against [' . $this->xsdFilename . '] succeeded');
         $this->testProperty->addTestResultDescription('Validation of [' . $this->fileName . '] against [' . $this->xsdFilename . '] succeeded');
         $this->testProperty->addTestResultReportDescription('Filen ' . $this->fileName . ' validerer mot filen' . $this->xsdFilename);
     } else {
         $this->testProperty->addTestResult(false);
         $this->logger->error(' RESULT Validation of [' . $this->fileName . '] against [' . $this->xsdFilename . '] failed');
         $this->testProperty->addTestResultDescription('Validation of [' . $this->fileName . '] against [' . $this->xsdFilename . '] failed');
         $this->testProperty->addTestResultReportDescription('Filen ' . $this->fileName . ' validerer ikke mot filen' . $this->xsdFilename);
     }
     libxml_clear_errors();
 }
开发者ID:HaakonME,项目名称:noark5-validator,代码行数:34,代码来源:XMLTestValidation.php


示例6: test

 /**
  * Method to test the value.
  *
  * @param   JXMLElement  &$element  The JXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed        $value     The form field value to validate.
  * @param   string       $group     The field name group control value. This acts as as an array container for the field.
  *                                  For example if the field has name="foo" and the group value is set to "bar" then the
  *                                  full field name would end up being "bar[foo]".
  * @param   JRegistry    &$input    An optional JRegistry object with the entire data set to validate against the entire form.
  * @param   object       &$form     The form object for which the field is being tested.
  *
  * @return  boolean  True if the value is valid, false otherwise.
  *
  * @since   11.1
  * @throws  JException on invalid rule.
  */
 public function test(&$element, $value, $group = null, &$input = null, &$form = null)
 {
     if (empty($value)) {
         return true;
     }
     // compatibility workaround: in some environments XML document is
     // saved with all "<styles>" element opening tags replaced with
     // "<s-tyles>". We allow this replace (as it can be DB security
     // concerned: looks like an HTML element <style...) and do not
     // report error. Later the original element syntax will be restored
     $value = str_replace('<s-tyles>', '<styles>', $value);
     // now XML document should be valid
     jimport('joomla.utilities.xmlelement');
     libxml_use_internal_errors(true);
     $xml = simplexml_load_string($value, 'JXMLElement');
     if ($xml === false) {
         $errors = array(JText::_('MOD_SMARTCDPRO_ERROR_DIGITS_XML_ERROR'));
         foreach (libxml_get_errors() as $error) {
             $errors[] = 'XML: ' . $error->message;
         }
         $element['message'] = implode('<br />', $errors);
         return false;
     }
     $field = $xml->getName();
     if ($field != 'config') {
         $element['message'] = JText::_('MOD_SMARTCDPRO_ERROR_DIGITS_XML_CONFIG_MISSING');
         return false;
     }
     if (!$xml->xpath('//digit[@scope="*"]')) {
         $element['message'] = JText::_('MOD_SMARTCDPRO_ERROR_DIGITS_XML_DEFAULT_DIGIT_MISSING');
         return false;
     }
     $element['message'] = '';
     return true;
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:51,代码来源:digitsxml.php


示例7: getScheme

 /**
  * Creates and returns XmlScheme object for addon
  *
  * @param  string    $addon_id Addon name
  * @param  string    $path     Path to addons
  * @return AXmlScheme object
  */
 public static function getScheme($addon_id, $path = '')
 {
     if (empty($path)) {
         $path = Registry::get('config.dir.addons');
     }
     libxml_use_internal_errors(true);
     if (!isset(self::$schemas[$addon_id])) {
         $_xml = self::readXml($path . $addon_id . '/addon.xml');
         if ($_xml !== FALSE) {
             $versions = self::getVersionDefinition();
             $version = isset($_xml['scheme']) ? (string) $_xml['scheme'] : '1.0';
             self::$schemas[$addon_id] = new $versions[$version]($_xml);
         } else {
             $errors = libxml_get_errors();
             $text_errors = array();
             foreach ($errors as $error) {
                 $text_errors[] = self::displayXmlError($error, $_xml);
             }
             libxml_clear_errors();
             if (!empty($text_errors)) {
                 fn_set_notification('E', __('xml_error'), '<br/>' . implode('<br/>', $text_errors));
             }
             return false;
         }
     }
     return self::$schemas[$addon_id];
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:34,代码来源:SchemesManager.php


示例8: is_valid_drv_file

 /**
  * Check a given XML file against the DRV rules
  *
  * @param string $pathToFile full path to the XML file
  * @return bool if there were any errors during processing
  */
 private function is_valid_drv_file($pathToFile)
 {
     $hasErrors = false;
     // Enable user error handling
     libxml_use_internal_errors(true);
     $xml = new \DOMDocument();
     $xml->load($pathToFile);
     $pathToSchema = realpath($this->get('kernel')->getRootDir() . '/Resources/drv_import/meldungen_2010.xsd');
     if (!file_exists($pathToSchema)) {
         $message = 'Konnte DRV-Schema auf Server nicht finden!';
         $this->addFlash('error', $message);
         $this->get('logger')->warning($message . ' Gesuchter Pfad: ' . $pathToSchema);
         $hasErrors = true;
     }
     if (!$hasErrors && !$xml->schemaValidate($pathToSchema)) {
         if (self::DRV_DEBUG) {
             print '<b>DOMDocument::schemaValidate() generated Errors!</b>' . "\n";
             $errors = libxml_get_errors();
             libxml_clear_errors();
             foreach ($errors as $error) {
                 print '<<<<<<<<<<<<<<<<<<<<<<<<<' . "\n";
                 print $this->libxml_display_error($error);
                 print_r($error);
                 print '>>>>>>>>>>>>>>>>>>>>>>>>>' . "\n";
             }
         } else {
             $this->addFlash('error', 'Nur XML-Export-Dateien vom DRV sind erlaubt!');
             $hasErrors = true;
         }
     }
     return $hasErrors;
 }
开发者ID:ruderphilipp,项目名称:regatta,代码行数:38,代码来源:DrvImportController.php


示例9: show_internal_errors

function show_internal_errors()
{
    foreach (libxml_get_errors() as $error) {
        printf("Internal: %s\n", $error->message);
    }
    libxml_clear_errors();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:bug64230.php


示例10: getParserError

 /**
  *  Fetch error for current parser
  *  
  *  @access protected
  *  @return string the error message
  */
 protected function getParserError()
 {
     $errors = '';
     foreach (libxml_get_errors() as $error) {
         $return = '';
         switch ($error->level) {
             case LIBXML_ERR_WARNING:
                 $return .= "Warning {$error->code}: ";
                 break;
             case LIBXML_ERR_ERROR:
                 $return .= "Error {$error->code}: ";
                 break;
             case LIBXML_ERR_FATAL:
                 $return .= "Fatal Error {$error->code}: ";
                 break;
         }
         $return .= trim($error->message) . PHP_EOL . "  Line: {$error->line}" . PHP_EOL . "  Column: {$error->column}";
         if ($error->file) {
             $return .= PHP_EOL . "  File: {$error->file}";
         }
         #combine with other error messages
         $errors .= PHP_EOL . $return;
     }
     return $errors;
 }
开发者ID:icomefromthenet,项目名称:faker,代码行数:31,代码来源:SIMPLEXML.php


示例11: initDomDocument

 /**
  * Initialize DOM document
  */
 public function initDomDocument()
 {
     if (null === ($document = $this->getDocument())) {
         #require_once 'Zend/Dom/Exception.php';
         throw new Zend_Dom_Exception('Cannot query; no document registered');
     }
     libxml_use_internal_errors(true);
     $this->_domDocument = new DOMDocument();
     switch ($this->getDocumentType()) {
         case self::DOC_XML:
             $success = $this->_domDocument->loadXML($document);
             break;
         case self::DOC_HTML:
         case self::DOC_XHTML:
         default:
             $success = $this->_domDocument->loadHTML($document);
             break;
     }
     $errors = libxml_get_errors();
     if (!empty($errors)) {
         $this->_documentErrors = $errors;
         libxml_clear_errors();
     }
     libxml_use_internal_errors(false);
     if (!$success) {
         #require_once 'Zend/Dom/Exception.php';
         throw new Zend_Dom_Exception(sprintf('Error parsing document (type == %s)', $this->getDocumentType()));
     }
     return $this;
 }
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:33,代码来源:Zendquery.php


示例12: processXML

 protected function processXML($input)
 {
     try {
         if (!isset($input[2])) {
             throw new Exception("Invalid Input");
         }
         libxml_use_internal_errors(true);
         // convert the xml into Object
         $inputObject = simplexml_load_string($input, "SimpleXMLElement", LIBXML_NOCDATA);
         if (!$inputObject) {
             // @var Array to store the error messages
             $errors = array();
             // loop through the errors and store the errors in $errors
             foreach (libxml_get_errors() as $e) {
                 $errors[] = $e->message;
             }
             // @var String Errors are joined by a newline
             $errors = join("\n", $errors);
             // throw the error
             throw new Exception($errors);
         }
         // if !$inputObject
         foreach ($inputObject as $name => $value) {
             $val = strtolower(trim($value)) == '(null)' ? '' : trim($value);
             $inputObject->{$name} = $val;
         }
         return $inputObject;
     } catch (Exception $e) {
         $this->setError($e->getMessage());
     }
 }
开发者ID:rapsody,项目名称:HeartwebApp,代码行数:31,代码来源:Common.class.php


示例13: importXML

 /**
  * Import the xml document from the stream into the repository
  *
  * @param NodeInterface              $parentNode   as in importXML
  * @param NamespaceRegistryInterface $ns           as in importXML
  * @param string                     $uri          as in importXML
  * @param integer                    $uuidBehavior as in importXML
  *
  * @see PHPCR\SessionInterface::importXML
  */
 public static function importXML(NodeInterface $parentNode, NamespaceRegistryInterface $ns, $uri, $uuidBehavior)
 {
     $use_errors = libxml_use_internal_errors(true);
     libxml_clear_errors();
     if (!file_exists($uri)) {
         throw new \RuntimeException("File {$uri} does not exist or is not readable");
     }
     $xml = new FilteredXMLReader();
     $xml->open($uri);
     if (libxml_get_errors()) {
         libxml_use_internal_errors($use_errors);
         throw new InvalidSerializedDataException("Invalid xml file {$uri}");
     }
     $xml->read();
     try {
         if ('node' == $xml->localName && NamespaceRegistryInterface::NAMESPACE_SV == $xml->namespaceURI) {
             // TODO: validate with DTD?
             self::importSystemView($parentNode, $ns, $xml, $uuidBehavior);
         } else {
             self::importDocumentView($parentNode, $ns, $xml, $uuidBehavior);
         }
     } catch (\Exception $e) {
         // restore libxml setting
         libxml_use_internal_errors($use_errors);
         // and rethrow exception to not hide it
         throw $e;
     }
     libxml_use_internal_errors($use_errors);
 }
开发者ID:viral810,项目名称:ngSimpleCMS,代码行数:39,代码来源:ImportExport.php


示例14: convert

 /**
  * Create a PHP array from the XML file
  *
  * @param String $xmlFile The XML file or a string containing xml to parse
  *
  * @return Array
  *
  * @throws \Propel\Common\Config\Exception\XmlParseException if parse errors occur
  */
 public static function convert($xmlToParse)
 {
     if (!is_string($xmlToParse)) {
         throw new InvalidArgumentException("XmlToArrayConverter::convert method expects an xml file to parse, or a string containing valid xml");
     }
     if (file_exists($xmlToParse)) {
         $xmlToParse = file_get_contents($xmlToParse);
     }
     //Empty xml file returns empty array
     if ('' === $xmlToParse) {
         return array();
     }
     if ($xmlToParse[0] !== '<') {
         throw new InvalidArgumentException('Invalid xml content');
     }
     $currentEntityLoader = libxml_disable_entity_loader(true);
     $currentInternalErrors = libxml_use_internal_errors(true);
     $xml = simplexml_load_string($xmlToParse);
     $errors = libxml_get_errors();
     libxml_clear_errors();
     libxml_use_internal_errors($currentInternalErrors);
     libxml_disable_entity_loader($currentEntityLoader);
     if (count($errors) > 0) {
         throw new XmlParseException($errors);
     }
     $conf = self::simpleXmlToArray($xml);
     return $conf;
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:37,代码来源:XmlToArrayConverter.php


示例15: getXml

 /**
  * Convert xml string to SimpleXMLElement
  *
  * @param string $data String of retrieved data
  *
  * @return \SimpleXMLElement
  * @throws XmlException
  */
 public static function getXml($data)
 {
     if (self::$libXmlLoaded === null) {
         self::$libXmlLoaded = extension_loaded('libxml');
     }
     if (self::$libXmlLoaded) {
         libxml_use_internal_errors(true);
     }
     $simpleXml = simplexml_load_string($data);
     if (!$simpleXml) {
         if (self::$libXmlLoaded) {
             $xmlErrors = libxml_get_errors();
             $errors = array();
             foreach ($xmlErrors as $error) {
                 $errors[] = sprintf('Error in file %s on line %d with message : %s', $error->file, $error->line, $error->message);
             }
             if (count($errors) > 0) {
                 throw new XmlException(implode("\n", $errors));
             }
         }
         // @codeCoverageIgnore
         throw new XmlException('Xml file cound not be loaded.');
     }
     return $simpleXml;
 }
开发者ID:axalian,项目名称:axtvdb,代码行数:33,代码来源:XmlParser.php


示例16: build

 /**
  * @param \Jarves\Configuration\Object[] $objects
  * @param OutputInterface $output
  *
  * @param bool $overwrite
  * @throws ModelBuildException
  */
 public function build(array $objects, OutputInterface $output, $overwrite = false)
 {
     /** @var $jarves \Jarves\Jarves */
     $jarves = $this->kernel->getContainer()->get('jarves');
     $output->writeln('Propel Build');
     foreach ($objects as $object) {
         if ($this->kernel->getContainer()->get($object->getStorageService()) instanceof \Jarves\Storage\Propel) {
             $output->write('Build object ' . $object->getId() . ' => ' . $object->getTable() . ' ... ');
             $bundlePath = $jarves->getBundleDir($object->getBundle()->getName());
             $modelsFile = sprintf('%sResources/config/schema/%s.schema.xml', $bundlePath, strtolower($object->getTable()));
             if (!$overwrite && file_exists($modelsFile) && file_get_contents($modelsFile)) {
                 $xml = @simplexml_load_file($modelsFile);
                 if (false === $xml) {
                     $errors = libxml_get_errors();
                     throw new ModelBuildException(sprintf('Parse error in %s: %s', $modelsFile, json_encode($errors, JSON_PRETTY_PRINT)));
                 }
             } else {
                 $xml = simplexml_load_string('<database></database>');
             }
             $xml['namespace'] = $object->getBundle()->getNamespace() . '\\Model';
             //                $xml['package'] = $object->getBundle()->getNamespace() . '\\Model';
             $xml['name'] = 'default';
             $this->declareTable($xml, $object);
             if (!is_dir(dirname($modelsFile))) {
                 mkdir(dirname($modelsFile), 0777, true);
             }
             file_put_contents($modelsFile, $this->getFormattedXml($xml));
             $output->writeln($modelsFile . ' written.');
             unset($xml);
         }
     }
 }
开发者ID:jarves,项目名称:jarves,代码行数:39,代码来源:Propel.php


示例17: import_xml

 public static function import_xml($file)
 {
     $defaults = array('forms' => 0, 'fields' => 0, 'terms' => 0);
     $imported = array('imported' => $defaults, 'updated' => $defaults, 'forms' => array());
     unset($defaults);
     if (!defined('WP_IMPORTING')) {
         define('WP_IMPORTING', true);
     }
     if (!class_exists('DOMDocument')) {
         return new WP_Error('SimpleXML_parse_error', __('Your server does not have XML enabled', 'formidable'), libxml_get_errors());
     }
     $dom = new DOMDocument();
     $success = $dom->loadXML(file_get_contents($file));
     if (!$success) {
         return new WP_Error('SimpleXML_parse_error', __('There was an error when reading this XML file', 'formidable'), libxml_get_errors());
     }
     $xml = simplexml_import_dom($dom);
     unset($dom);
     // halt if loading produces an error
     if (!$xml) {
         return new WP_Error('SimpleXML_parse_error', __('There was an error when reading this XML file', 'formidable'), libxml_get_errors());
     }
     // add terms, forms (form and field ids), posts (post ids), and entries to db, in that order
     // grab cats, tags and terms
     if (isset($xml->term)) {
         $imported = self::import_xml_terms($xml->term, $imported);
         unset($xml->term);
     }
     if (isset($xml->form)) {
         $imported = self::import_xml_forms($xml->form, $imported);
         unset($xml->form);
     }
     $return = apply_filters('frm_importing_xml', $imported, $xml);
     return $return;
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:35,代码来源:FrmXMLHelper.php


示例18: __construct

 public function __construct($strConfigSet = "")
 {
     libxml_use_internal_errors();
     $this->objSimpleXml = simplexml_load_file(SVN2RSS_PROJECT_ROOT . "/" . SVN2RSS_CONFIG_FILE);
     $arrParseErrors = libxml_get_errors();
     libxml_clear_errors();
     if (count($arrParseErrors) > 0) {
         throw new Svn2RssException("Error parsing xml-config-file " . SVN2RSS_CONFIG_FILE . ".\nErrors:\n" . implode("\n", $arrParseErrors));
     }
     if ($strConfigSet == "") {
         $strConfigSet = $this->getStrDefaultConfigSet();
     }
     if ($strConfigSet == "") {
         throw new Svn2RssException("No default config-set defined in " . SVN2RSS_CONFIG_FILE);
     }
     //load the config-set requested
     $this->strConfigSetName = $strConfigSet;
     foreach ($this->objSimpleXml->configSets->configSet as $objOneConfigSet) {
         $arrAttributes = $objOneConfigSet->attributes();
         if ($arrAttributes->id . "" == $strConfigSet) {
             $this->objCurrentConfigSetXml = $objOneConfigSet;
         }
     }
     if ($this->objCurrentConfigSetXml == null) {
         throw new Svn2RssException("Loading of config set " . $strConfigSet . " failed.");
     }
 }
开发者ID:rcappuccio,项目名称:gitsvn,代码行数:27,代码来源:ConfigReader.php


示例19: getPinterest

 public function getPinterest()
 {
     $url = 'http://www.pinterest.com/wheatwildflower/feed.rss';
     if (($response_xml_data = file_get_contents($url)) === false) {
         echo "Error fetching XML\n";
         die;
     } else {
         libxml_use_internal_errors(true);
         $data = simplexml_load_string($response_xml_data);
         if (!$data) {
             echo "Error loading XML\n";
             die;
             foreach (libxml_get_errors() as $error) {
                 echo "\t", $error->message;
             }
         } else {
             $json = array();
             $json['imgs'] = array();
             foreach ($data as $channel) {
                 foreach ($channel as $pin) {
                     if ((string) $pin->description) {
                         $doc = new DOMDocument();
                         $doc->loadHTML((string) $pin->description[0]);
                         $pinHTML = $pin->description[0];
                         $img = substr($pinHTML, strpos($pinHTML, "src=") + 5, strpos($pinHTML, ".jpg") + 5 - (strpos($pinHTML, "src=") + 6));
                         $json['imgs'][] = $img;
                     }
                 }
             }
             header('Content-Type: application/json');
             echo json_encode($json);
             die;
         }
     }
 }
开发者ID:noikiy,项目名称:laravel-buyer-seller-admin,代码行数:35,代码来源:SocialController.php


示例20: testLoadFileWithInternalErrorsEnabled

 public function testLoadFileWithInternalErrorsEnabled()
 {
     libxml_use_internal_errors(true);
     $this->assertSame(array(), libxml_get_errors());
     $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile(__DIR__ . '/../Fixtures/Util/invalid_schema.xml'));
     $this->assertSame(array(), libxml_get_errors());
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:7,代码来源:XmlUtilsTest.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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