當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DomDocument::relaxNGValidateSource方法代碼示例

本文整理匯總了PHP中DomDocument::relaxNGValidateSource方法的典型用法代碼示例。如果您正苦於以下問題:PHP DomDocument::relaxNGValidateSource方法的具體用法?PHP DomDocument::relaxNGValidateSource怎麽用?PHP DomDocument::relaxNGValidateSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DomDocument的用法示例。


在下文中一共展示了DomDocument::relaxNGValidateSource方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: relaxNGValidateSource

 /**
  * Validates the current document against a RelaxNG schema,
  * optionally validates embedded Schematron rules too.
  *
  * \param string $source
  *      Source of the RelaxNG schema to use for validation.
  *
  * \param bool $schematron
  *      (optional) Whether embedded Schematron rules
  *      should be validated too (\b true) or not (\b false).
  *      The default is to also do $schematron validation.
  *
  * \retval bool
  *      \b true if the document validates,
  *      \b false otherwise.
  */
 public function relaxNGValidateSource($source, $schematron = true)
 {
     $success = parent::relaxNGValidateSource($source);
     return $this->schematronValidation('string', $source, 'RNG', $success, $schematron);
 }
開發者ID:erebot,項目名稱:dom,代碼行數:21,代碼來源:DOM.php

示例2: __construct

 /**
  * Constructs a new ezcTreeXml object from the XML data in $xmlFile and using
  * the $store to retrieve data from.
  *
  * @param string $xmlFile
  * @param ezcTreeXmlDataStore $store
  */
 public function __construct($xmlFile, ezcTreeXmlDataStore $store)
 {
     if (!file_exists($xmlFile)) {
         throw new ezcBaseFileNotFoundException($xmlFile, "XML");
     }
     $previous = libxml_use_internal_errors(true);
     $dom = new DomDocument();
     $dom->load($xmlFile);
     $dom->formatOutput = true;
     $errors = libxml_get_errors();
     libxml_clear_errors();
     if (count($errors)) {
         throw new ezcTreeInvalidXmlException($xmlFile, $errors);
     }
     $valid = $dom->relaxNGValidateSource(self::relaxNG);
     if (!$valid) {
         $errors = libxml_get_errors();
         libxml_clear_errors();
         throw new ezcTreeInvalidXmlFormatException($xmlFile, $errors);
     }
     libxml_use_internal_errors($previous);
     // Associate the DOM tree with the data store
     $store->setDomTree($dom);
     // Figure out the prefix - which is the "prefix" attribute on the root node.
     $document = $dom->documentElement;
     $prefix = $document->getAttribute('prefix');
     // Figure out the last auto generated ID
     $autoId = false;
     $this->autoNodeId = $document->getAttribute('lastNodeId');
     if ($this->autoNodeId !== "") {
         $autoId = true;
     }
     // Set member variables
     $this->dom = $dom;
     $this->xmlFile = $xmlFile;
     $this->properties['store'] = $store;
     $this->properties['prefix'] = $prefix;
     $this->properties['autoId'] = $autoId;
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:46,代碼來源:xml.php

示例3: relaxNGValidate

 private function relaxNGValidate(\DomDocument $dom, $ng)
 {
     try {
         $dom->relaxNGValidateSource($ng);
         $this->throwError();
     } catch (\DOMException $e) {
         throw new \RuntimeException($e->getMessage());
     }
 }
開發者ID:ducbin,項目名稱:behatch-contexts,代碼行數:9,代碼來源:XmlContext.php


注:本文中的DomDocument::relaxNGValidateSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。