Get xml with root element.

@return string
342475
public function outerXml()
    {
        $attributes = '';
        foreach ($this->getAttributes() as $name => $value) {
            if ($value === null) {
                // Self-closing attribute format.
                $attributes .= " $name";
            } else {
                // Full attribute format.
                $value = addslashes($value);
                $attributes .= " $name=\"$value\"";
            }
        }

        // Self-closing element format.
        if ($this->getText() === null && count($this->getChildren()) == 0) {
            return "<{$this->getName()}$attributes/>";
        }

        // Full element format.
        return "<{$this->getName()}$attributes>{$this->innerXml()}</{$this->getName()}>";
    }
720729
protected function getRequestXml()
    {
        $serviceXmlNode = "<" . $this->getServiceName() . "/>";
        $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?>' . $serviceXmlNode);
        $xml->addAttribute('version', $this->getServiceVersion());

        $bodyChild = $xml->addChild('body');
        $bodyChild->addAttribute('merchantId', $this->getMerchantId());

        $transactionChild = $bodyChild->addChild('transaction');
        $transactionChild->addAttribute('refno', $this->getTransactionId());

        $requestChild = $transactionChild->addChild('request');

        $this->prepareRequestXml($requestChild);

        $requestChild->addChild('sign', $this->getSign());

        return $xml;
    }
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;
    }
1264676
public function getRoot()
    {
        if ($this->getSection()->getRoot() instanceof Section) {
            return $this->getSection()->getRoot()->getPage();
        }

        return null;
    }
1045259
public function getCAML () {
		// Start with empty string
		$xml = '';

		// Add where
		if (!empty($this->where_caml)) {
			$xml = '<Where>' . $this->where_caml . '</Where>';
		}

		// add sort
		if (!empty($this->sort_caml)) {
			$xml .= $this->sort_caml;
		}

		return $xml;
	}
808030
public function getXMLContent()
    {
        if ($this->xmlContent === null) {
            try {
                if (($content = $this->getContent()) === '') {
                    return $this->xmlContent = false;
                }
                $errors = libxml_use_internal_errors(true);
                $this->xmlContent = new \SimpleXMLElement($content);
                libxml_use_internal_errors($errors);
            } catch (\Exception $E) {
                return $this->xmlContent = false;
            }
        }

        return $this->xmlContent;
    }
944027
public function xml()
    {
        foreach ($this->_result as $disk_items) {
            if (isset($disk_items['Name']) && (trim($disk_items['Name']) !== '')) {
                $xmlstablebit_disk = $this->xml->addChild("Disk");
                foreach ($this->stablebit_items as $item) {
                    if (isset($disk_items[$item]) && (($itemvalue=$disk_items[$item]) !== '') &&
                    (($item !== 'SerialNumber') || (defined('PSI_PLUGIN_STABLEBIT_SHOW_SERIAL') && (PSI_PLUGIN_STABLEBIT_SHOW_SERIAL === true)))) {
                        $xmlstablebit_disk ->addAttribute($item, $itemvalue);
                    }
                }
            }
        }

        return $this->xml->getSimpleXmlElement();
    }
1058797
public function getNode()
    {
        if(null === $this->node)
        {
            $request = $this->requestStack->getCurrentRequest();
            $this->node = $this->readNode(RequestFilter::getFinder($request, $this->contentPath));
        }

        return $this->node;
    }
1025032
public function getRoot()
    {
        $tmp_parent = $this->getParent();
        $root = $tmp_parent;
        while ($tmp_parent) {
            $root = $tmp_parent;
            $tmp_parent = $tmp_parent->getParent();
        }

        return $root;
    }
825328
public function getXmlType()
	{
		if ( ! property_exists( $this->domNode, "schemaType" ) )
		{
			$effectiveNode = $this->domNode->nodeType == XML_TEXT_NODE ? $this->domNode->parentNode : $this->domNode;
			$this->domNode->schemaType = DOMSchemaType::getSchemaType( $effectiveNode );
		}
		return $this->domNode->schemaType;
	}
1190408
protected function getBaseXML()
    {
        foreach ($this->requiredFields as $field) {
            $this->validate($field);
        }

        $xml = new \SimpleXMLElement('<SecurePayMessage/>');

        $messageInfo = $xml->addChild('MessageInfo');
        $messageInfo->messageID = $this->getMessageId();
        $messageInfo->addChild('messageTimestamp', $this->generateTimestamp());
        $messageInfo->addChild('timeoutValue', 60);
        $messageInfo->addChild('apiVersion', 'xml-4.2');

        $merchantInfo = $xml->addChild('MerchantInfo');
        $merchantInfo->addChild('merchantID', $this->getMerchantId());
        $merchantInfo->addChild('password', $this->getTransactionPassword());

        $xml->addChild('RequestType', $this->requestType); // Not related to the transaction type

        return $xml;
    }
1019140
public function toSignedXML() : DOMElement
    {
        $root = $this->toUnsignedXML();

        if ($this->signatureKey === null) {
            /* We don't have a key to sign it with. */

            return $root;
        }

        /* Find the position we should insert the signature node at. */
        if ($this->issuer !== null) {
            /*
             * We have an issuer node. The signature node should come
             * after the issuer node.
             */
            $issuerNode = $root->firstChild;
            $insertBefore = $issuerNode->nextSibling;
        } else {
            /* No issuer node - the signature element should be the first element. */
            $insertBefore = $root->firstChild;
        }

        Utils::insertSignature($this->signatureKey, $this->certificates, $root, $insertBefore);

        return $root;
    }
769056
public function getRoot()
    {
        if (!$this->root) {
            $this->root = $this->active->getContext()->getCurrentSiteNode();
        }

        return $this->root;
    }
118062
public function documentRoot() {
        if ($this->documentRoot == null) {
            $this->documentRoot = isset($this->serverVariables['DOCUMENT_ROOT']) ? $this->serverVariables['DOCUMENT_ROOT'] : substr(PHPMVC_ROOT_PATH, 0, -1);
        }

        return $this->documentRoot;
    }
1000451
public function getRootNodeMenuItem()
    {
        if (is_null($this->rootNodeMenuItem)) {
            $rootNode = $this->domainConfiguration->getRootNode();
            if (!is_null($rootNode)) {
                $nodeTranslation = $rootNode->getNodeTranslation(
                    $this->locale,
                    $this->includeOffline
                );
                $this->rootNodeMenuItem = new NodeMenuItem(
                    $rootNode,
                    $nodeTranslation,
                    false,
                    $this
                );
            } else {
                $this->rootNodeMenuItem = $this->breadCrumb[0];
            }
        }

        return $this->rootNodeMenuItem;
    }
1121819
protected function getXPath()
    {
        if (!$this->xpath) {
            $this->xpath = new \DOMXPath($this->getDomElement()->ownerDocument);
            $namespaces = $this->getExtensions()->getNamespaces();
            foreach ($namespaces as $prefix => $namespace) {
                $this->xpath->registerNamespace($prefix, $namespace);
            }
        }

        return $this->xpath;
    }
1165188
public static function root()
    {
        $url = request('REQUEST_URI', '', 'server');
        $root = request('DOCUMENT_ROOT', '', 'server');
        $scheme = request('REQUEST_SCHEME', '', 'server');
        $server = request('SERVER_NAME', '', 'server');

        $url = substr($url, 1);

        $parts = explode('/', $url);
        //
        $folder = '';
        //
        for ($i = 0; $i < count($parts); $i++) {
            if (File::isDirectory($root.$folder.$parts[$i].'/')) {
                $folder .= $parts[$i].'/';
            } else {
                break;
            }
        }

        return $scheme.'://'.$server.'/'.$folder;
    }