public function clean(dom\handler $doc) { $sResult = ''; if (!$doc->isEmpty()) { $sResult = $this->cleanValid($doc); } return $sResult; }
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); }
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; }
/** * * @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; }
protected function setDocument(dom\handler $doc) { $doc->registerNamespaces($this->getNS()); $this->document = $doc; }
protected function loadTest(dom\handler $doc) { $iTest = $this->getTestKey(); $result = $doc->getx("self:test[position() = {$iTest}]"); return $result; }
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; }
protected function loadMode(dom\handler $doc) { return $doc->readx('@mode', array(), false); }
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); }