当前位置: 首页>>代码示例>>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;未经允许,请勿转载。