Ejemplo n.º 1
0
 public function clean(dom\handler $doc)
 {
     $sResult = '';
     if (!$doc->isEmpty()) {
         $sResult = $this->cleanValid($doc);
     }
     return $sResult;
 }
Ejemplo n.º 2
0
 public function setDocument(dom\handler $doc)
 {
     $sNamespace = $doc->getRoot()->getNamespace();
     $parser = $this->getManager(self::PARSER_MANAGER);
     $builder = $parser->loadBuilderFromNS($sNamespace, null, null, $this->getScript(self::ARGUMENTS));
     $builder->setDocument($doc);
     $result = $builder->getSchema();
     $this->setSchema($result);
 }
Ejemplo n.º 3
0
 protected function loadDocument(dom\handler $doc, fs\file $file)
 {
     $aResult = array();
     $iDisabled = 0;
     require_once 'core/functions/Global.php';
     $tests = $doc->queryx('self:test[@standalone]', array(), false);
     if (!$tests->length) {
         $tests = $doc->queryx('self:test');
     } else {
         dsp('WARNING : @standalone activated on ' . $file->asToken());
     }
     foreach ($tests as $test) {
         if (!$test->testAttribute('disabled', false)) {
             $aResult[] = $this->loadElement($test, $doc, $file);
         } else {
             $iDisabled++;
         }
     }
     $aResult['disabled'] = $iDisabled;
     return $aResult;
 }
Ejemplo n.º 4
0
 /**
  *
  * @param \sylma\dom\handler $doc
  * @param type $bXML
  * @return \sylma\dom\handler
  */
 public function parseDocument(dom\handler $doc, $bXML = true)
 {
     // WARNING, XML_Document typed can cause crashes
     $mResult = null;
     $dom = $this->getControler();
     if ($doc->isEmpty()) {
         $doc->throwException('Cannot parse empty document');
     }
     if ($this->isEmpty()) {
         $this->throwException(t('Cannot parse empty template'));
     }
     $this->includeExternals();
     libxml_use_internal_errors(true);
     $this->getProcessor()->importStylesheet($this->getDocument());
     $this->retrieveErrors();
     libxml_clear_errors();
     if ($bXML) {
         $doc->getRoot();
         $mResult = $this->getProcessor()->transformToDoc($doc->getDocument());
         if ($mResult && $mResult->documentElement) {
             $mResult = $dom->create('handler', array($mResult));
         } else {
             $this->throwException('No result on parsing');
         }
     } else {
         $mResult = $this->getProcessor()->transformToXML($doc->getDocument());
     }
     $this->retrieveErrors();
     libxml_clear_errors();
     libxml_use_internal_errors(false);
     $dom->addStat('parse', array($this, $doc));
     return $mResult;
 }
Ejemplo n.º 5
0
 protected function setDocument(dom\handler $doc)
 {
     $doc->registerNamespaces($this->getNS());
     $this->document = $doc;
 }
Ejemplo n.º 6
0
 protected function loadTest(dom\handler $doc)
 {
     $iTest = $this->getTestKey();
     $result = $doc->getx("self:test[position() = {$iTest}]");
     return $result;
 }
Ejemplo n.º 7
0
 protected function getClass(dom\handler $doc)
 {
     if (!($sResult = $doc->getRoot()->readx('@build:class', array(self::BUILD_PREFIX => self::BUILD_NS), false))) {
         $sResult = $this->readArgument('cache/class');
     }
     return $sResult;
 }
Ejemplo n.º 8
0
 protected function loadMode(dom\handler $doc)
 {
     return $doc->readx('@mode', array(), false);
 }
Ejemplo n.º 9
0
 protected function buildInfos(dom\handler $doc)
 {
     $body = $doc->getx('//html:body');
     $content = $this->loadInfos($doc);
     $system = $body->addElement('div', null, array('id' => 'sylma-system'));
     $system->addElement('div', $content);
 }