当前位置: 首页>>代码示例>>PHP>>正文


PHP DOMDocument::schemaValidate方法代码示例

本文整理汇总了PHP中DOMDocument::schemaValidate方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMDocument::schemaValidate方法的具体用法?PHP DOMDocument::schemaValidate怎么用?PHP DOMDocument::schemaValidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DOMDocument的用法示例。


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

示例1: save

 /**
  * Save FB2 file
  * @param string $path
  */
 public function save($path = '')
 {
     if ($this->fictionBook instanceof FictionBook) {
         self::$FB2DOM = new \DOMDocument("1.0", "UTF-8");
         self::$FB2DOM->preserveWhiteSpace = FALSE;
         self::$FB2DOM->formatOutput = TRUE;
         $this->fictionBook->buildXML();
         self::$FB2DOM->schemaValidate("./XSD/FB2.2/FictionBook.xsd");
         //$domDoc->schemaValidate("./XSD/FB2.0/FictionBook2.xsd");
         self::$FB2DOM->save($path);
         echo self::$FB2DOM->saveXML();
     }
 }
开发者ID:head26,项目名称:FictionBookConverter,代码行数:17,代码来源:FB2Builder.php

示例2: loadSX

 function loadSX()
 {
     $xml = simplexml_load_file($this->_xml);
     $newDoc = new DOMDocument();
     $products = $newDoc->createElement("Allitems");
     foreach ($xml as $product) {
         $domDoc = new DOMDocument();
         $domDoc->loadXML($product->asXML());
         $x = $domDoc->documentElement;
         if (!$domDoc->schemaValidate($this->_xsd)) {
             $errors = libxml_get_errors();
             foreach ($errors as $error) {
                 //print libxml_display_error($error);
             }
             libxml_clear_errors();
         } else {
             print "validation successful\n";
             $item = $newDoc->createElement("Item");
             $i = 1;
             foreach ($x->childNodes as $ele) {
                 if (!$ele instanceof DOMElement) {
                     continue;
                 }
                 $nodeData = $newDoc->createElement(trim($ele->nodeName), $ele->nodeValue);
                 $item->appendChild($nodeData);
             }
             $products->appendChild($item);
             $newDoc->appendChild($products);
             $newDoc->formatOutput = true;
             print $newDoc->saveXML();
         }
     }
     print_r($newDoc->saveXML());
 }
开发者ID:johnalvn,项目名称:xmltranslator,代码行数:34,代码来源:XmlTrasnlator.php

示例3: do_upload

 /**
  * @desc This method process a uploaded file with the upload method form and
  * validate this uploaded file front to a xsd file in the upload folder
  */
 public function do_upload()
 {
     $ud = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR;
     $config['upload_path'] = $ud . 'temp' . DIRECTORY_SEPARATOR;
     $config['allowed_types'] = 'xml';
     $config['max_size'] = 1024 * 1024;
     $this->load->library('upload', $config);
     if (!$this->upload->do_upload()) {
         $error = array('error' => $this->upload->display_errors());
         $this->load->view('upload', $error);
     } else {
         $data = array('upload_data' => $this->upload->data());
         $document = new DOMDocument();
         $document->loadXML(file_get_contents($data['upload_data']['full_path']));
         if ($document->schemaValidate(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . 'books.xsd')) {
             $data['message'] = 'File successfully loaded';
             unlink($ud . "books.xml");
             rename($data['upload_data']['full_path'], $ud . "books.xml");
         } else {
             $xsdUrl = base_url('books.xsd');
             $data['error'] = "<span style='color: red'>Xml file not valid, please verify and try again, if need see xsd file must be downloaded from <a href='{$xsdUrl}' target='_blank'>{$xsdUrl}</a></span><br />";
         }
         $this->load->view('upload', $data);
     }
 }
开发者ID:hansellramos,项目名称:pacific-test-backend,代码行数:29,代码来源:Book.php

示例4: validate

 public function validate()
 {
     $document = new \DOMDocument();
     $document->loadXML($this->asXML());
     $filename = 'path/to/schema.xsd';
     return $document->schemaValidate($filename);
 }
开发者ID:skullab,项目名称:thunderhawk,代码行数:7,代码来源:Manifest.php

示例5: 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

示例6: testAddFunctionMultiple

    function testAddFunctionMultiple()
    {
        $server = new Zend_Soap_AutoDiscover();
        $server->addFunction('Zend_Soap_AutoDiscover_TestFunc');
        $server->addFunction('Zend_Soap_AutoDiscover_TestFunc2');
        $server->addFunction('Zend_Soap_AutoDiscover_TestFunc3');
        $server->addFunction('Zend_Soap_AutoDiscover_TestFunc4');
        $server->addFunction('Zend_Soap_AutoDiscover_TestFunc5');
        $server->addFunction('Zend_Soap_AutoDiscover_TestFunc6');
        $server->addFunction('Zend_Soap_AutoDiscover_TestFunc7');
        $server->addFunction('Zend_Soap_AutoDiscover_TestFunc9');
        $dom = new DOMDocument();
        ob_start();
        $server->handle();
        $dom->loadXML(ob_get_contents());
        $dom->save(dirname(__FILE__) . '/addfunction2.wsdl');
        ob_end_clean();
        $parts = explode('.', basename($_SERVER['SCRIPT_NAME']));
        $name = $parts[0];
        $wsdl = '<?xml version="1.0"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://' . $_SERVER['PHP_SELF'] . '" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" name="' . $name . '" targetNamespace="http://' . $_SERVER['PHP_SELF'] . '"><portType name="' . $name . 'Port"><operation name="Zend_Soap_AutoDiscover_TestFunc"><input message="tns:Zend_Soap_AutoDiscover_TestFuncRequest"/><output message="tns:Zend_Soap_AutoDiscover_TestFuncResponse"/></operation><operation name="Zend_Soap_AutoDiscover_TestFunc2"><input message="tns:Zend_Soap_AutoDiscover_TestFunc2Request"/><output message="tns:Zend_Soap_AutoDiscover_TestFunc2Response"/></operation><operation name="Zend_Soap_AutoDiscover_TestFunc3"><input message="tns:Zend_Soap_AutoDiscover_TestFunc3Request"/><output message="tns:Zend_Soap_AutoDiscover_TestFunc3Response"/></operation><operation name="Zend_Soap_AutoDiscover_TestFunc4"><input message="tns:Zend_Soap_AutoDiscover_TestFunc4Request"/><output message="tns:Zend_Soap_AutoDiscover_TestFunc4Response"/></operation><operation name="Zend_Soap_AutoDiscover_TestFunc5"><input message="tns:Zend_Soap_AutoDiscover_TestFunc5Request"/><output message="tns:Zend_Soap_AutoDiscover_TestFunc5Response"/></operation><operation name="Zend_Soap_AutoDiscover_TestFunc6"><input message="tns:Zend_Soap_AutoDiscover_TestFunc6Request"/><output message="tns:Zend_Soap_AutoDiscover_TestFunc6Response"/></operation><operation name="Zend_Soap_AutoDiscover_TestFunc7"><input message="tns:Zend_Soap_AutoDiscover_TestFunc7Request"/><output message="tns:Zend_Soap_AutoDiscover_TestFunc7Response"/></operation><operation name="Zend_Soap_AutoDiscover_TestFunc9"><input message="tns:Zend_Soap_AutoDiscover_TestFunc9Request"/><output message="tns:Zend_Soap_AutoDiscover_TestFunc9Response"/></operation></portType><binding name="' . $name . 'Binding" type="tns:' . $name . 'Port"><soap:operation soapAction="http://' . $_SERVER['PHP_SELF'] . '#Zend_Soap_AutoDiscover_TestFunc9"/><soap:operation soapAction="http://' . $_SERVER['PHP_SELF'] . '#Zend_Soap_AutoDiscover_TestFunc7"/><soap:operation soapAction="http://' . $_SERVER['PHP_SELF'] . '#Zend_Soap_AutoDiscover_TestFunc6"/><soap:operation soapAction="http://' . $_SERVER['PHP_SELF'] . '#Zend_Soap_AutoDiscover_TestFunc5"/><soap:operation soapAction="http://' . $_SERVER['PHP_SELF'] . '#Zend_Soap_AutoDiscover_TestFunc4"/><soap:operation soapAction="http://' . $_SERVER['PHP_SELF'] . '#Zend_Soap_AutoDiscover_TestFunc3"/><soap:operation soapAction="http://' . $_SERVER['PHP_SELF'] . '#Zend_Soap_AutoDiscover_TestFunc2"/><soap:operation soapAction="http://' . $_SERVER['PHP_SELF'] . '#Zend_Soap_AutoDiscover_TestFunc"/><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="Zend_Soap_AutoDiscover_TestFunc"><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="Zend_Soap_AutoDiscover_TestFunc2"><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="Zend_Soap_AutoDiscover_TestFunc3"><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="Zend_Soap_AutoDiscover_TestFunc4"><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="Zend_Soap_AutoDiscover_TestFunc5"><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="Zend_Soap_AutoDiscover_TestFunc6"><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="Zend_Soap_AutoDiscover_TestFunc7"><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="Zend_Soap_AutoDiscover_TestFunc9"><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation></binding><service name="' . $name . 'Service"><port name="' . $name . 'Port" binding="tns:' . $name . 'Binding"><soap:address location="http://' . $_SERVER['PHP_SELF'] . '"/></port></service><message name="Zend_Soap_AutoDiscover_TestFuncRequest"><part name="who" type="xsd:string"/></message><message name="Zend_Soap_AutoDiscover_TestFuncResponse"><part name="Zend_Soap_AutoDiscover_TestFuncReturn" type="xsd:string"/></message><message name="Zend_Soap_AutoDiscover_TestFunc2Request"/><message name="Zend_Soap_AutoDiscover_TestFunc3Request"/><message name="Zend_Soap_AutoDiscover_TestFunc3Response"><part name="Zend_Soap_AutoDiscover_TestFunc3Return" type="xsd:boolean"/></message><message name="Zend_Soap_AutoDiscover_TestFunc4Request"/><message name="Zend_Soap_AutoDiscover_TestFunc4Response"><part name="Zend_Soap_AutoDiscover_TestFunc4Return" type="xsd:boolean"/></message><message name="Zend_Soap_AutoDiscover_TestFunc5Request"/><message name="Zend_Soap_AutoDiscover_TestFunc5Response"><part name="Zend_Soap_AutoDiscover_TestFunc5Return" type="xsd:int"/></message><message name="Zend_Soap_AutoDiscover_TestFunc6Request"/><message name="Zend_Soap_AutoDiscover_TestFunc6Response"><part name="Zend_Soap_AutoDiscover_TestFunc6Return" type="xsd:string"/></message><message name="Zend_Soap_AutoDiscover_TestFunc7Request"/><message name="Zend_Soap_AutoDiscover_TestFunc7Response"><part name="Zend_Soap_AutoDiscover_TestFunc7Return" type="soap-enc:Array"/></message><message name="Zend_Soap_AutoDiscover_TestFunc9Request"><part name="foo" type="xsd:string"/><part name="bar" type="xsd:string"/></message><message name="Zend_Soap_AutoDiscover_TestFunc9Response"><part name="Zend_Soap_AutoDiscover_TestFunc9Return" type="xsd:string"/></message></definitions>
';
        $this->assertEquals($wsdl, $dom->saveXML(), "Bad WSDL generated");
        $this->assertTrue($dom->schemaValidate(dirname(__FILE__) . '/schemas/wsdl.xsd'), "WSDL Did not validate");
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:25,代码来源:AutoDiscoverTest.php

示例7: validate

 /**
  * @param string $xml
  * @param string $schema
  *
  * @return XsdError[]
  */
 private function validate($xml, $schema)
 {
     $result = [];
     libxml_clear_errors();
     $doc = new \DOMDocument();
     set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) use(&$result) {
         $error = new XsdError(XsdError::FATAL, $errno, $errstr, 0, 0);
         $result[] = $error;
     });
     $schemaFile = __DIR__ . '/../../../../../xsd/' . $schema;
     if (!is_file($schemaFile)) {
         throw new LightSamlXmlException('Invalid schema specified');
     }
     $ok = @$doc->loadXML($xml);
     if (!$ok) {
         restore_error_handler();
         return [new XsdError(XsdError::FATAL, 0, 'Invalid XML', 0, 0)];
     }
     @$doc->schemaValidate($schemaFile);
     /** @var \LibXMLError[] $errors */
     $errors = libxml_get_errors();
     foreach ($errors as $error) {
         $err = XsdError::fromLibXMLError($error);
         $result[] = $err;
     }
     restore_error_handler();
     return $result;
 }
开发者ID:lightsaml,项目名称:lightsaml,代码行数:34,代码来源:XsdValidator.php

示例8: array

 function __construct($XSD_SCHEMA)
 {
     $this->EDIFACT = array("INTERCHANGE_HEADER" => array("SYNTAX_IDENTIFIER" => array("SYNTAX_IDENTIFIER" => "TEST", "SYNTAX_VERSION_NUMBER" => "TEST", "SERVICE_CODE_LIST_DIRECTORY_VERSION_NUMBER" => "TEST", "CHARACTER_ENCODING" => "TEST"), "INTERCHANGE_SENDER" => array("INTERCHANGE_SENDER_IDENTIFICATION" => "TEST", "IDENTIFICATION_CODE_QUALIFIER" => "TEST", "INTERCHANGE_SENDER_INTERNAL_IDENTIFICATION" => "TEST", "INTERCHANGE_SENDER_INTERNAL_SUB_IDENTIFICATION" => "TEST"), "INTERCHANGE_RECEIPENT" => array("INTERCHANGE_RECEIPENT_IDENTIFICATION" => "TEST", "IDENTIFICATION_CODE_QUALIFIER" => "TEST", "INTERCHANGE_RECEIPENT_INTERNAL_IDENTIFICATION" => "TEST", "INTERCHANGE_RECEIPENT_INTERNAL_SUB_IDENTIFICATION" => "TEST"), "SYNTAX_IDENTIFIER" => array("SYNTAX_IDENTIFIER" => "TEST", "SYNTAX_VERSION_NUMBER" => "TEST", "SERVICE_CODE_LIST_DIRECTORY_VERSION_NUMBER" => "TEST", "CHARACTER_ENCODING" => "TEST"), "DATE_AND_TIME_OF_PREPARATION" => array("DATE" => "TEST", "TIME" => "TEST"), "RECEIPENT_S_REFERENCE_PASSWORD_DETAILS" => array("RECEIPENT_REFERENCE_PASSWORD" => "TEST", "RECEIPENT_REFERENCE_PASSWORD_QUALIFIER" => "TEST"), "APPLICATION_REFERENCE" => "TEST", "PROCESSING_PRIORITY_CODE" => "TEST", "ACKNOWLEDGE_AGREEMENT_IDENTIFIER" => "TEST", "INTERCHANGE_AGREEMENT_IDENTIFIER" => "TEST", "TEST_INDICATOR" => "TEST"));
     $XML = new DOMDocument();
     $XML->loadXML($this->ARRAY_TO_XML($this->EDIFACT));
     var_dump($XML->schemaValidate($XSD_SCHEMA));
 }
开发者ID:tekinnnnn,项目名称:PROJECT_1,代码行数:7,代码来源:class.EDIFACT_DELFOR_D_96_A.php

示例9: testValidateXmlSchema

 /**
  * @param string $xmlMappingFile
  * @dataProvider dataValidSchema
  */
 public function testValidateXmlSchema($xmlMappingFile)
 {
     $xsdSchemaFile = __DIR__ . "/../../../../../doctrine-mapping.xsd";
     $dom = new \DOMDocument('UTF-8');
     $dom->load($xmlMappingFile);
     $this->assertTrue($dom->schemaValidate($xsdSchemaFile));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:11,代码来源:XmlMappingDriverTest.php

示例10: load

 public static function load($xmlfile)
 {
     if (is_file($xmlfile)) {
         $dom = new \DOMDocument();
         libxml_use_internal_errors(true);
         $dom->load($xmlfile);
         if ($dom->schemaValidate(__DIR__ . "/../Resources/xsd/star.xsd")) {
             $root = $dom->documentElement;
             //  Preliminary path modifications
             foreach ($root->getElementsByTagName("include") as $include) {
                 $include->nodeValue = FileUtils::resolveRelativePath(FileUtils::getFileParent($xmlfile), $include->nodeValue);
             }
             //  Reading attributes
             $actions = array();
             foreach (XMLUtils::getChildrenByName($root, "action") as $child) {
                 $actions[] = AbstractAction::parse($child);
             }
             $subsites = array();
             foreach (XMLUtils::getChildrenByName($root, "subsite") as $child) {
                 $subsites[] = Subsite::parse($child);
             }
             $targets = array();
             foreach (XMLUtils::getChildrenByName($root, "target") as $child) {
                 $targets[] = Target::parse($child);
             }
             return new Site($subsites, $targets, $actions);
         } else {
             //$errors = libxml_get_errors();
             throw new \Exception("Document validation failed for '" . $xmlfile . "'");
         }
     } else {
         throw new \Exception("Not a file '" . $xmlfile . "'");
     }
 }
开发者ID:pierrelemee,项目名称:star,代码行数:34,代码来源:Site.php

示例11: validate

 /**
  * Validate the xml file
  *
  * @return bool
  */
 public function validate()
 {
     // Check if a valid xml is given.
     if (null === $this->xml) {
         $this->addError('No valid xml given.');
         return false;
     }
     // Check if the validation file exists
     $dataDir = Mage::getConfig()->getModuleDir('etc', 'Itabs_Debit') . DS . 'data' . DS;
     $filePath = $dataDir . $this->getSchema();
     if (!file_exists($filePath)) {
         $this->addError('XSD for validation does not exist.');
         return false;
     }
     libxml_use_internal_errors(true);
     $dom = new DOMDocument();
     // Check if the xml document is well formed
     $result = $dom->loadXML($this->getXml());
     if ($result === false) {
         $this->addError('Document is not well formed.');
         return false;
     }
     // Validate the xml against the schema
     if (!$dom->schemaValidate($filePath)) {
         $documentErrors = "Document is not valid:\n";
         $errors = libxml_get_errors();
         foreach ($errors as $error) {
             /* @var $error LibXMLError */
             $documentErrors .= "---\n" . sprintf("file: %s, line: %s, column: %s, level: %s, code: %s\nError: %s", basename($error->file), $error->line, $error->column, $error->level, $error->code, $error->message);
         }
         $this->addError($documentErrors);
         return false;
     }
     return true;
 }
开发者ID:pette87,项目名称:Magento-DebitPayment,代码行数:40,代码来源:Validation.php

示例12: validate

 public function validate()
 {
     $source = $this->toXML();
     preg_match_all('/schemaLocation=(".+"|\'.+\')/U', $source, $matches);
     $locations = array();
     if (isset($matches[1])) {
         foreach ($matches[1] as $match) {
             $location = substr($match, 1, -1);
             if (strpos($location, " ") === false) {
                 $locations[] = $location;
             } else {
                 $location = preg_replace("/ {2,}/", " ", $location);
                 $_tmp = explode(" ", $location);
                 for ($i = 1, $c = count($_tmp); $i < $c; $i += 2) {
                     $locations[] = $_tmp[$i];
                 }
             }
         }
     }
     $handler = new Sabel_Xml_Validate_ErrorHandler();
     set_error_handler(array($handler, "setError"));
     foreach ($locations as $location) {
         $this->document->schemaValidate($location);
     }
     restore_error_handler();
     return $handler;
 }
开发者ID:reoring,项目名称:sabel,代码行数:27,代码来源:Document.php

示例13: validaXML

 function validaXML($sXML, $xsdFile)
 {
     libxml_use_internal_errors(true);
     $dom = new DOMDocument();
     $xml = $dom->loadXML($sXML);
     $erromsg = '';
     if (!$dom->schemaValidate($xsdFile)) {
         $aIntErrors = libxml_get_errors();
         $flagOK = FALSE;
         foreach ($aIntErrors as $intError) {
             switch ($intError->level) {
                 case LIBXML_ERR_WARNING:
                     $erromsg .= " Atenção {$intError->code}: ";
                     break;
                 case LIBXML_ERR_ERROR:
                     $erromsg .= " Erro {$intError->code}: ";
                     break;
                 case LIBXML_ERR_FATAL:
                     $erromsg .= " Erro fatal {$intError->code}: ";
                     break;
             }
             $erromsg .= $intError->message . ';';
         }
     } else {
         $flagOK = TRUE;
         $this->errorStatus = FALSE;
         $this->errorMsg = '';
     }
     if (!$flagOK) {
         $this->errorStatus = TRUE;
         $this->errorMsg = $erromsg;
     }
     return $flagOK;
 }
开发者ID:vagnerbarros,项目名称:testephpsvn2,代码行数:34,代码来源:NFeTools.class.php

示例14: assertSchemaValidate

 function assertSchemaValidate($xml)
 {
     $xsd = __DIR__ . "/../../cache/FATCA XML Schema v1.1/FatcaXML_v1.1.xsd";
     $doc = new \DOMDocument();
     $xmlDom = $doc->loadXML($xml);
     $this->assertTrue($doc->schemaValidate($xsd));
 }
开发者ID:shadiakiki1986,项目名称:fatca-ides-php,代码行数:7,代码来源:Array2OecdTest.php

示例15: testValidateSchema

 /**
  * @dataProvider dataValidateSchemaFiles
  * @param string $file
  */
 public function testValidateSchema($file)
 {
     $found = false;
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->load($file);
     $dbalElements = $dom->getElementsByTagNameNS("http://symfony.com/schema/dic/doctrine", "config");
     if ($dbalElements->length) {
         $dbalDom = new \DOMDocument('1.0', 'UTF-8');
         $dbalNode = $dbalDom->importNode($dbalElements->item(0));
         $dbalDom->appendChild($dbalNode);
         $ret = $dbalDom->schemaValidate(__DIR__ . "/../../Resources/config/schema/doctrine-1.0.xsd");
         $this->assertTrue($ret, "DoctrineBundle Dependency Injection XMLSchema did not validate this XML instance.");
         $found = true;
     }
     $ormElements = $dom->getElementsByTagNameNS("http://symfony.com/schema/dic/doctrine", "config");
     if ($ormElements->length) {
         $ormDom = new \DOMDocument('1.0', 'UTF-8');
         $ormNode = $ormDom->importNode($ormElements->item(0));
         $ormDom->appendChild($ormNode);
         $ret = $ormDom->schemaValidate(__DIR__ . "/../../Resources/config/schema/doctrine-1.0.xsd");
         $this->assertTrue($ret, "DoctrineBundle Dependency Injection XMLSchema did not validate this XML instance.");
         $found = true;
     }
     $this->assertTrue($found, "Neither <doctrine:orm> nor <doctrine:dbal> elements found in given XML. Are namespaces configured correctly?");
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:29,代码来源:XMLSchemaTest.php


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