Transforms loaded XML and XSL and returns Result.
@access		public
@return		string
183679
public function transform()
	{
		if( !( $this->xml && $this->xsl ) )
			throw new InvalidArgumentException( 'XML and XSL must be set.' );
		$xml	= DOMDocument::loadXML( $this->xml );
		$xsl	= DOMDocument::loadXML( $this->xsl );
		$proc	= new XSLTProcessor();
		$proc->importStyleSheet( $xsl );
		$result =  $proc->transformToXML( $xml );
		return $result;
	}
384869
public function toXML()
    {

        $oXMLout = new \XMLWriter();
        $oXMLout->openMemory();
        $oXMLout->setIndent(true);
        $oXMLout->setIndentString('    ');
        $className = explode('\\', get_class($this->entity));

        $className = lcfirst(end($className));

        $nodeName = lcfirst(($this->taskType) . ucfirst($className));

        $oXMLout->startElement($nodeName);

        if($this->entity instanceof Invoice && $this->option && $this->option instanceof InvoiceInstruction){
            $oXMLout->writeAttribute("emailToContact", $this->option->emailToContact);
            if($this->option->templateUid > 0){
                $oXMLout->writeElement('templateUid', $this->option->templateUid);
            }
            if($this->option->emailMessage){
                $oXMLout->writeRaw( "\n".$this->option->emailMessage->toXML());
            }
        }


        $oXMLout->writeRaw("\n".$this->entity->toXML());

        $oXMLout->endElement();

        $string = $oXMLout->outputMemory();

        return $string;

    }
597715
public static function transform($xslFileName, DOMDocument $xml)
    {
        $xsl = new DOMDocument;
        $xsl->load(__DIR__.'/../../xslt/'.$xslFileName.'.xsl');

        $proc = new XSLTProcessor;
        $proc->importStyleSheet($xsl);

        libxml_use_internal_errors(true);

        $result = $proc->transformToXML($xml);

        foreach (libxml_get_errors() as $error) {
            //throw new \Exception($error->message);
        }

        return $result;
    }
1289633
protected function getXML()
    {
        $key = 'xml_' . md5($this->url); // Everybody loves md5!

        if ($this->cache->has($key)) {
            $this->xml = $this->cache->get($key);
        } else {
            $this->xml = $this->fetchXML();

            $this->xml = $this->changeLinkElements($this->xml);

            $this->cache->put($key, $this->xml, $this->cacheTime);
        }
    }
693027
public function toXML()
    {
        $namespace = 'tns';
        $writer = new XMLWriter();
        $writer->openMemory();
        $writer->setIndent(true);
        $writer->setIndentString('    ');
        $writer->startElementNs($namespace, 'BrRac', null);
        $writer->writeElementNs($namespace, 'BrOznRac', null, $this->getInvoiceNumber());
        $writer->writeElementNs($namespace, 'OznPosPr', null, $this->getBusinessLocationCode());
        $writer->writeElementNs($namespace, 'OznNapUr', null, $this->getPaymentDeviceCode());
        $writer->endElement();

        return $writer->outputMemory();
    }
1224123
function to_xml(){
		if ($this->skip) return "";
		$str="";
		for ($i = 0; $i < count($this->config->data); $i++) {
			$str .= "<".$this->config->data[$i]['name']."><![CDATA[".$this->data[$this->config->data[$i]['name']]."]]></".$this->config->data[$i]['name'].">";
		}
		return $str;
	}
917133
public function toXML()
    {
        $namespace = 'tns';
        $writer = new XMLWriter();
        $writer->openMemory();
        $writer->setIndent(true);
        $writer->setIndentString('    ');
        $writer->startElementNs($namespace, 'Porez', null);
        if ($this->getName()) {
            $writer->writeElementNs($namespace, 'Naziv', null, $this->getName());
        }
        $writer->writeElementNs($namespace, 'Stopa', null, $this->getRate());
        $writer->writeElementNs($namespace, 'Osnovica', null, $this->getBaseValue());
        $writer->writeElementNs($namespace, 'Iznos', null, $this->getValue());
        $writer->endElement();

        return $writer->outputMemory();
    }
455602
public function transformToHTML($xml)
    {
        if (is_string($xml)) {
            $dom = new DOMDocument();
            $dom->load($xml);
        } else {
            $dom = $xml;
        }
        $out = $this->xsltProcessor->transformToXML($dom);

        // fudges for HTML backwards compatibility
        // assumes that document is XHTML
        $out = str_replace('/>', ' />', $out); // <br /> not <br/>
        $out = str_replace(' xmlns=""', '', $out); // rm unnecessary xmlns

        if (class_exists('Tidy')) {
            // cleanup output
            $config = array(
                'indent'        => true,
                'output-xhtml'  => true,
                'wrap'          => 80
            );
            $tidy = new Tidy;
            $tidy->parseString($out, $config, 'utf8');
            $tidy->cleanRepair();
            $out = (string) $tidy;
        }

        return $out;
    }
723110
public function toUnsignedXML() : DOMElement
    {
        $root = parent::toUnsignedXML();

        foreach ($this->attributes as $name => $values) {
            $attribute = $root->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:Attribute');
            $root->appendChild($attribute);
            $attribute->setAttribute('Name', $name);

            if ($this->nameFormat !== Constants::NAMEFORMAT_UNSPECIFIED) {
                $attribute->setAttribute('NameFormat', $this->nameFormat);
            }

            foreach ($values as $value) {
                if (is_string($value)) {
                    $type = 'xs:string';
                } elseif (is_int($value)) {
                    $type = 'xs:integer';
                } else {
                    $type = null;
                }

                $attributeValue = Utils::addString(
                    $attribute,
                    Constants::NS_SAML,
                    'saml:AttributeValue',
                    strval($value)
                );
                if ($type !== null) {
                    $attributeValue->setAttributeNS(Constants::NS_XSI, 'xsi:type', $type);
                }
            }
        }

        return $root;
    }
615298
public function getXmlContent()
    {        
        if($this->getUseCache() && file_exists(get_storage_path('cache').$this->getCacheFileName())) { 
            $contents = file_get_contents(get_storage_path('cache').$this->getCacheFileName());
        } else {
            $contents = file_get_contents( $this->getUrl());
            file_put_contents(get_storage_path('cache').$this->getCacheFileName(), $contents);
        }        
        return simplexml_load_string( $contents);
    }
1127782
public function toXml()
    {
        $data = $this->toArray();

        $writer = new \SimpleXMLElement('<Table/>');
        $headers = [];
        foreach ($data as $index => $item) {

            if ($index==0) {
                $headers = $item;
            }
            $child = $writer->addChild('Row');
            foreach ($headers as $k => $name) {
                $child->addChild('Cell', $item[$k]);
            }
        }

        $dom = dom_import_simplexml($writer)->ownerDocument;
        $dom->formatOutput = true;
        // $dom->save($filename);
        return $dom->saveXML();
    }
119173
public function xml()
    {
        if (strtoupper($this->encoding) !== 'ISO-8859-1') {
            return false;
        }
        try {
            $converted = utf8_encode($this->string);
        } catch (\Exception $e) {
            return false;
        }
        return $converted;
    }
584579
public function xmlOutput() {
        $o = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
        $o.= '<XMLDB PATH="' . $this->path . '"';
        $o.= ' VERSION="' . $this->version . '"';
        if ($this->comment) {
            $o.= ' COMMENT="' . htmlspecialchars($this->comment) . '"'."\n";
        }
        $rel = array_fill(0, count(explode('/', $this->path)), '..');
        $rel = implode('/', $rel);
        $o.= '    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'."\n";
        $o.= '    xsi:noNamespaceSchemaLocation="'.$rel.'/lib/xmldb/xmldb.xsd"'."\n";
        $o.= '>' . "\n";
        // Now the tables
        if ($this->tables) {
            $o.= '  <TABLES>' . "\n";
            foreach ($this->tables as $table) {
                $o.= $table->xmlOutput();
            }
            $o.= '  </TABLES>' . "\n";
        }
        $o.= '</XMLDB>';

        return $o;
    }
137431
protected function _getXml()
    {
        if ($this->_xml) {
            return $this->_xml;
        }
        libxml_use_internal_errors();
        $data = simplexml_load_string($this->_getBody());
        if ($data) {
            $this->_xml = $data;

            return $this->_xml;
        }

        return null;
    }
411805
public function transform($xslDocument)
    {
        if ($xslDocument->domDocument) {
            $processor = new \XsltProcessor();
            $processor->importStylesheet($xslDocument->domDocument);
            $htmlDomDocument = new self;
            $htmlDomDocument->domDocument = $processor->transformToDoc($this->domDocument);

            if (!$htmlDomDocument->domDocument) {
                throw new Dom\Exception('The XSL transformation has failed.');
            }
        } else {
            throw new Dom\Exception('There is no XSL template to transform with.');
        }

        try {
            return $htmlDomDocument->toString(false);
        } catch (\Exception $exception) {
            $this->logger->error($exception->getMessage());
            throw new Dom\Exception("dom-transform-failed");
        }
    }
1281004
private function readXlsx()
    {
        $zipHandle = new \ZipArchive();
        $outputText = '';
        if (true === $zipHandle->open($this->filename)) {
            if (($xmlIndex = $zipHandle->locateName('xl/sharedStrings.xml')) !== false) {
                $xmlData = $zipHandle->getFromIndex($xmlIndex);
                $domDocument = new \DOMDocument();
                $domDocument->loadXML($xmlData, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
                $outputText = strip_tags(str_replace('</t>', ' </t>', $domDocument->saveXML()));
            } else {
                $outputText .= '';
            }
            $zipHandle->close();
        } else {
            $outputText .= '';
        }
        return $outputText;
    }
1065114
public function ToString()
	{
		if ( is_null( $this->domNode ) ) return "";
		if ( $this->domNode instanceof \DOMDocument )
		{
			$result = $this->domNode->saveXML( null );
			// Remove any initial PI
			$result = preg_replace( "/^<\?xml.*\?>\s/", "", $result );
			return $result;
		}
		else
		{
			// InnerXml?
			// return array_reduce(
			// 	iterator_to_array( $this->domNode->childNodes ),
			// 	function ( $carry, /** @var \DOMNode */ $child )
			// 	{
			// 		return $carry.$child->ownerDocument->saveXML( $child );
			// 	}
			// );
			$result = $this->domNode->ownerDocument->SaveXML( $this->domNode );
			return $result;
		}
	}