Formats the document according to the standard's specification
@param  \DOMDocument $document
@return \DOMDocument
165248
public function format(\DOMDocument $document) : \DOMDocument
    {
        $element = $document->createElement('feed');
        $element->setAttribute('xmlns', 'http://www.w3.org/2005/Atom');
        $document->appendChild($element);

        return $document;
    }
497555
public function convert(DOMDocument $document)
    {
        $this->processTag($document, 'ezembed', false);
        $this->processTag($document, 'ezembedinline', true);

        return $document;
    }
336070
private function importXml(\DOMDocument $doc)
    {
        $importNodes=$doc->getElementsByTagName("import");
        for($i=$importNodes->length-1;$i>=0;$i--){
            $node = $importNodes->item($i);
            if($node->hasAttribute("file")){
                $file=$node->getAttribute("file");
                $path=rtrim(dirname($this->m_configFile),"/");
                $file=$path."/".ltrim($file,"/");
                if(file_exists($file)){
                    $_doc=new \DOMDocument();
                    $_doc->load($file);
                    $this->importXml($_doc);
                    $children=$_doc->documentElement->childNodes;
                    for($j=0;$j<$children->length;$j++){
                        $_node=$children->item($j);
                        if(is_a($_node,"DOMElement")){
                            $_node = $doc->importNode($_node, true);
                            $node->parentNode->insertBefore($_node,$node);
                        }
                    }
                    if(!in_array($file, $this->m_configFiles)){
                        $this->m_configFiles[]=$file;
                    }
                }
            }
            $node->parentNode->removeChild($node);
        }
    }
1312591
public function getXML(\DOMDocument $document)
    {
        $xml = $document->createElement('ns2:DataStorageItem');

        $ccData = $this->creditCardData->getXML($document);
        $dataId = $document->createElement('ns2:HostedDataID');
        $dataId->textContent = $this->hostedDataId;

        if ($this->function != null) {
            $function = $document->createElement('ns2:Function');
            $function->textContent = $this->function;
            $xml->appendChild($function);
        }
        if ($this->declineHostedDataDuplicates != null) {
            $declineDuplicates = $document->createElement('ns2:DeclineHostedDataDuplicates');
            $declineDuplicates->textContent = $this->declineHostedDataDuplicates;
            $xml->appendChild($declineDuplicates);
        }

        $xml->appendChild($ccData);
        $xml->appendChild($dataId);

        return $xml;
    }
1265761
public function dispatch(DOMDocument $document)
    {
        $documentNamespace = $document->documentElement->lookupNamespaceURI(null);
        // checking for null as ezxml has no default namespace...
        if ($documentNamespace === null) {
            $documentNamespace = $document->documentElement->lookupNamespaceURI('xhtml');
        }

        foreach ($this->mapping as $namespace => $validator) {
            if ($documentNamespace === $namespace) {
                if ($validator === null) {
                    return array();
                }

                return $validator->validate($document);
            }
        }

        throw new NotFoundException('Validator', $documentNamespace);
    }
1072611
protected function createDomDocumentFromHtml($html)
    {
        $document = new \DOMDocument('1.0', 'UTF-8');
        $internalErrors = libxml_use_internal_errors(true);
        if (!empty($html)) {
            $document->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
        }
        libxml_use_internal_errors($internalErrors);
        $document->formatOutput = true;

        return $document;
    }
698606
public static function toDOMDocument($xml)
    {
        if ($xml instanceof \DOMDocument) {
            return $xml;
        }

        if ($xml instanceof \SimpleXMLElement) {
            $doc = new \DOMDocument();
            $doc->loadXML('' . $xml->asXML());

            return $doc;
        }

        if (is_string($xml)) {
            $doc = new \DOMDocument();

            if (is_file($xml)) {
                $doc->load($xml);

                return $doc;
            }

            $doc->loadXML($xml);

            return $doc;
        }

        $type = is_object($xml) ? get_class($xml) : gettype($xml);

        throw new \InvalidArgumentException("Cannot convert instance of '$type' to DOMDocument");
    }
314122
public function toXML( DOMDocument $dom )
    {
        $zoneNode = $dom->createElement( 'zone' );
        foreach ( $this->attributes as $attrName => $attrValue )
        {
            switch ( $attrName )
            {
                case 'id':
                    $zoneNode->setAttribute( 'id', 'id_' . $attrValue );
                    break;

                case 'action':
                    $zoneNode->setAttribute( 'action', $attrValue );
                    break;

                case 'blocks':
                    foreach ( $this->attributes['blocks'] as $block )
                    {
                        $blockNode = $block->toXML( $dom );
                        $zoneNode->appendChild( $blockNode );
                    }
                    break;

                default:
                    $node = $dom->createElement( $attrName );
                    $nodeValue = $dom->createTextNode( $attrValue );
                    $node->appendChild( $nodeValue );
                    $zoneNode->appendChild( $node );
                    break;
            }
        }

        return $zoneNode;
    }
446768
public function render(\DOMDocument $domDocument)
    {
        $frame = new Frame();
        $frame->setPosition($this->posX, $this->posY, $this->posZ)
            ->setSize($this->width, $this->height)
            ->addClasses(["uiContainer", "uiTextbox"]);

        $quad = new Quad();
        $quad->setSize(($this->width * 2), ($this->height * 2))
            ->setScale(0.5)
            ->setPosition(0, 0)
            ->setStyles('Bgs1', 'BgColorContour')
            ->setAlign("left", "top")
            ->setBackgroundColor('FFFA');


        $input = new TextEdit();
        $input->setSize($this->width, $this->height - 2)
            ->setPosition(1, -1)
            ->setDefault($this->default)
            ->setAlign("left", "top")
            ->addClass("UiInput")
            ->setAreaColor("0005")
            ->setAreaFocusColor('000a')
            ->setTextFormat('Basic')
            ->setName($this->name)
            ->setScriptEvents(true)
            ->addClasses($this->_classes)
            ->setTextSize(1.5)
            ->setDataAttributes($this->_dataAttributes);

        $frame->addChild($quad);
        $frame->addChild($input);

        return $frame->render($domDocument);
    }
1124775
public function render(\DOMDocument $domDocument)
    {
        $container = new Frame();
        $container->setPosition($this->frame_posX, $this->frame_posY);

        $quad = new Quad();
        // this quad is used to placeholder, if you need to add later "frame"  to the view.

        $contentFrame = new Frame();
        $contentFrame->addChild($this->parentFrame);

        $container->addChild($quad);
        $container->addChild($contentFrame);
        if ($this->scrollbarV) {
            $contentFrame->setSize($this->width - 5, $this->height);
            $this->offset = 5;
            $container->addChild(new Scrollbar(
                "Y",
                $this->getWidth(),
                0,
                10,
                $this->getHeight()
            ));
        }

        if ($this->scrollbarH) {
            $contentFrame->setSize($this->width - 5, $this->height - 5);
            $container->addChild(new Scrollbar(
                "X",
                0,
                -$this->getHeight(),
                10,
                $this->getWidth() - $this->offset
            ));
        }


        return $container->render($domDocument);
    }
1207164
public function render(\DOMDocument $domDocument)
    {
        $style3dXml = $domDocument->createElement("style3d");
        $this->checkId();
        if ($this->styleId) {
            $style3dXml->setAttribute("id", $this->styleId);
        }
        if ($this->model) {
            $style3dXml->setAttribute("model", $this->model);
        }
        if ($this->thickness) {
            $style3dXml->setAttribute("thickness", $this->thickness);
        }
        if ($this->color) {
            $style3dXml->setAttribute("color", $this->color);
        }
        if ($this->focusColor) {
            $style3dXml->setAttribute("fcolor", $this->focusColor);
        }
        if ($this->lightColor) {
            $style3dXml->setAttribute("lightcolor", $this->lightColor);
        }
        if ($this->focusLightColor) {
            $style3dXml->setAttribute("flightcolor", $this->focusLightColor);
        }
        if ($this->yOffset) {
            $style3dXml->setAttribute("yoffset", $this->yOffset);
        }
        if ($this->focusYOffset) {
            $style3dXml->setAttribute("fyoffset", $this->focusYOffset);
        }
        if ($this->zOffset) {
            $style3dXml->setAttribute("zoffset", $this->zOffset);
        }
        if ($this->focusZOffset) {
            $style3dXml->setAttribute("fzoffset", $this->focusZOffset);
        }
        return $style3dXml;
    }
1251130
public function toDOM(\DOMDocument $doc): \DOMNode
    {
        $paragraph = $doc->createElement('p');

        $this->customAttributesToDOM($paragraph);
        $this->containerToDOM($doc, $paragraph);

        return $paragraph;
    }
493545
public function render(\DOMDocument $domDocument)
    {
        $scriptXml  = $domDocument->createElement("script");
        $scriptText = $this->__toString();

        $scriptComment = $domDocument->createComment($scriptText);
        $scriptXml->appendChild($scriptComment);

        return $scriptXml;
    }
832608
private function getSchemaValidationFile(\DOMDocument $document)
    {
        $firstChild = $this->getFirstChild($document);
        // @codeCoverageIgnoreStart
        if (false === $firstChild) {
            return false;
        }
        // @codeCoverageIgnoreEnd

        $attribute = $firstChild->getAttribute('xsi:noNamespaceSchemaLocation');

        if (empty($attribute)) {
            return false;
        }

        return $attribute;
    }
1343902
public function render(\DOMDocument $domDocument)
    {
        $frame = new Frame();
        $frame->setPosition($this->posX, $this->posY)
            ->addClasses(["uiContainer", "uiInput"]);

        $quad = new Quad();
        $quad->setSize($this->width * 2, $this->height * 2)
            ->setScale(0.5)
            ->setPosition($this->width / 2, -$this->height / 2)
            ->setStyles('Bgs1', 'BgColorContour')
            ->setAlign("center", "center2")
            ->setBackgroundColor('FFFA')
            ->addClass("uiInput")
            ->setScriptEvents(true)
            ->setDataAttributes($this->_dataAttributes)->addClasses($this->_classes);

        $input = new Entry();
        $posX = 0;
        if ($this->horizontalAlign == "center") {
            $posX = $this->width / 2;
        }
        $input->setSize($this->width, $this->height)
            ->setPosition($posX, -($this->height / 2))
            ->setDefault($this->default)
            ->setSelectText(true)
            ->setAlign($this->horizontalAlign, "center")
            ->setAreaColor("0005")
            ->setAreaFocusColor('000a')
            ->setTextFormat($this->textFormat)
            ->setName($this->name)
            ->setTextSize(1.5)
            ->setScriptEvents(true)
            ->setId($this->id);
        if ($this->action !== null) {
            $input->addDataAttribute("action", $this->action);
        }

        $frame->addChild($quad);
        $frame->addChild($input);

        return $frame->render($domDocument);
    }
404819
protected function document(Document $document = null): ?Document {
        if ($document === null) {
            return $this->document;
        }

        $this->document = $document;

        return $this->document;
    }
1147953
public function render(\DOMDocument $domDocument)
    {
        $quad = new Quad();
        $quad->setPosition($this->posX + $this->x - 180, $this->posY + $this->y - 90);
        $quad->setBackgroundColor($this->color);
        if ($this->to) {
            $quad->setWidth($this->calcLength())->setHeight($this->stoke);
            $quad->setRotation($this->calcAngle());
        } else {
            $quad->setWidth($this->length)->setHeight($this->stoke);
            $quad->setRotation($this->rotate);
            $this->setWidth($this->length)->setHeight($this->stoke);
        }


        return $quad->render($domDocument);
    }