@param \DOMDocument $document

@return \DOMElement
972720
public function getXML(\DOMDocument $document)
    {
        $xml = $document->createElement('ns2:RecurringPaymentInformation');

        if ($this->startDate !== null) {
            $startDate              = $document->createElement('ns2:RecurringStartDate');
            $startDate->textContent = $this->startDate->format('Ymd');
            $xml->appendChild($startDate);
        }

        if ($this->installmentCount !== null) {
            $installmentCount              = $document->createElement('ns2:InstallmentCount');
            $installmentCount->textContent = $this->installmentCount;
            $xml->appendChild($installmentCount);
        }

        if ($this->installmentFrequency !== null) {
            $installmentFrequency              = $document->createElement('ns2:InstallmentFrequency');
            $installmentFrequency->textContent = $this->installmentFrequency;
            $xml->appendChild($installmentFrequency);
        }

        if ($this->installmentFrequency !== null) {
            $installmentPeriod              = $document->createElement('ns2:InstallmentPeriod');
            $installmentPeriod->textContent = $this->installmentPeriod;
            $xml->appendChild($installmentPeriod);
        }

        return $xml;
    }
409300
protected function getBlock(\DOMElement $element) {
    $block = '';
    /** @var \DOMNode $node */
    foreach ($element->childNodes as $node) {
      switch ($node->nodeType) {

        case XML_ELEMENT_NODE:
          /** @var \DOMElement $node */
          switch ($node->nodeName) {

            // Explicitly handle these elements.

            case 'i':
            case 'em':
              $block .= '*' . $this->getBlock($node) . '*';
              break;

            case 'b':
            case 'strong':
              $block .= '**' . $this->getBlock($node) . '**';
              break;

            case 'a':
              if ($node->hasAttribute('href')) {
                $block .= '[' . $this->getBlock($node) . ']' .
                  '(' . $node->getAttribute('href') . ')';
              }
              break;

            // Other inline elements.
            default:
              // Recursively handle any descendant elements we care about.
              $block .= $this->getBlock($node);
              break;

          }
          break;

        case XML_TEXT_NODE:
          /** @var \DOMText $node */
          $block .= self::escape($node->textContent);
          break;

      }
    }

    // Handle white-listed elements.
    if (in_array($element->nodeName, $this->white_list)) {
      $tag = $element->cloneNode();
      if (!empty($block)) {
        $tag->appendChild(new \DOMText($block));
      }
      $block = $this->dom->saveXML($tag);
    }

    return $block;
  }
1267675
protected function encodeLiteral(DOMDocument $document)
    {
        $xpath = new DOMXPath($document);

        $xpathExpression = '//literal[not(@class="html")]';

        $elements = $xpath->query($xpathExpression);

        foreach ($elements as $element) {
            $element->textContent = str_replace(']]>', ']]]]><![CDATA[>', $element->textContent);
        }
    }
342915
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::same($this->getElement()->namespaceURI, Constants::NS_SAML);
        Assert::same($this->getElement()->localName, "AttributeValue");

        return Utils::copyElement($this->element, $parent);
    }
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);
    }
1013082
protected function fieldToElement(DOMDocument $doc, string $value): DOMElement
    {
        $item = $doc->createElement($this->field_name);
        $item->appendChild($doc->createTextNode($value));

        return $item;
    }
1000668
public static function toDOM(BaseElement $element): \DOMDocument
    {
        $doc = new \DOMDocument('1.0', 'utf-8');
        $doc->appendChild($element->toDOM($doc));
        return $doc;
    }
1190233
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 => $converter) {
            if ($documentNamespace === $namespace) {
                if ($converter === null) {
                    return $document;
                }

                return $converter->convert($document);
            }
        }

        throw new NotFoundException('Converter', $documentNamespace);
    }
654951
public function process(\DOMDocument $xml)
    {
        $xpath = new \DOMXPath($xml);
        $nodes = $xpath->query(
            '/project/file/class/docblock/tag[@name="method"]'
        );

        /** @var \DOMElement $node */
        foreach ($nodes as $node) {
            $class = $node->parentNode->parentNode;

            $method = new \DOMElement('method');
            $class->appendChild($method);

            // set basic information
            $method->setAttribute('final', 'false');
            $method->setAttribute('static', 'false');
            $method->setAttribute('visibility', 'public');
            $method->setAttribute('line', $node->getAttribute('line'));
            $method->appendChild(
                new \DOMElement('name', $node->getAttribute('method_name'))
            );

            // fill docblock
            $docblock = new \DOMElement('docblock');
            $method->appendChild($docblock);
            $docblock->appendChild(
                new \DOMElement('description', $node->getAttribute('description'))
            );
            $docblock->appendChild(new \DOMElement('long-description'));

            // for each argument; create an @param tag and an argument element
            /** @var \DOMElement $argument */
            foreach ($node->getElementsByTagName('argument') as $argument) {
                $param_tag = new \DOMElement('tag');
                $docblock->appendChild($param_tag);
                $param_tag->setAttribute('name', 'param');
                $param_tag->setAttribute(
                    'type',
                    $argument->getElementsByTagName('type')->item(0)->nodeValue
                );
                $param_tag->setAttribute(
                    'variable',
                    $argument->getElementsByTagName('name')->item(0)->nodeValue
                );
                $param_tag->setAttribute('line', $node->getAttribute('line'));

                $types = explode(
                    '|',
                    $argument->getElementsByTagName('type')->item(0)->nodeValue
                );

                foreach ($types as $type) {
                    $type_element = new \DOMElement('type', $type);
                    $param_tag->appendChild($type_element);
                }

                $argument_element = $argument->cloneNode(true);
                $method->appendChild($argument_element);
            }

            // add a tag 'magic'
            $magic_tag = new \DOMElement('tag');
            $docblock->appendChild($magic_tag);
            $magic_tag->setAttribute('name', 'magic');
            $magic_tag->setAttribute('line', $node->getAttribute('line'));

            // add a @return tag
            $return_tag = new \DOMElement('tag');
            $docblock->appendChild($return_tag);
            $return_tag->setAttribute('name', 'return');
            $return_tag->setAttribute('line', $node->getAttribute('line'));
            $return_tag->setAttribute('type', $node->getAttribute('type'));

            // add type sub elements to the param
            foreach (explode('|', $node->getAttribute('type')) as $type) {
                $type_element = new \DOMElement('type', $type);
                $return_tag->appendChild($type_element);
            }

            // remove the tag, it is unneeded
            $node->parentNode->removeChild($node);
            $docblock->appendChild($node);
        }

        return $xml;
    }
668066
public function getXML(\DOMDocument $document)
    {
        $xml = $document->createElement('ns1:Payment');

        if (!empty($this->hostedDataId)) {
            $hostedDataId = $document->createElement('ns1:HostedDataID');
            $hostedDataId->textContent = $this->hostedDataId;

            $xml->appendChild($hostedDataId);
        }

        if (!empty($this->amount)) {
            $amount                = $document->createElement('ns1:ChargeTotal');
            $amount->textContent   = $this->amount;
            $currency              = $document->createElement('ns1:Currency');
            $currency->textContent = self::CURRENCY_EUR;

            $xml->appendChild($amount);
            $xml->appendChild($currency);
        }

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

        $this->document = $document;

        return $this->document;
    }
1307466
public function toXML(DOMDocument $doc, $nodeName = "")
    {
        $node = $doc->createElement($nodeName);
        $text = $doc->createTextNode($this->value);
        $node->appendChild($text);
        return $node;
    }
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);
    }
803980
private function getBodyElement(\DOMDocument $document)
    {
        $bodyElement = $document->getElementsByTagName('body')->item(0);
        if ($bodyElement === null) {
            throw new \BadMethodCallException(
                'getBodyElement method may only be called after ensureExistenceOfBodyElement has been called.',
                1508173775427
            );
        }

        return $bodyElement;
    }
419989
private function createMetadataNode(\DOMDocument $document, string $type = null): \DOMNode
    {
        $node = $document->createElement('object');
        if (null !== $type) {
            $node->setAttribute('type', $type);
        }

        return $node;
    }
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);
        }
    }
991076
public function getLocaleForDocument($document)
    {
        $oid = $this->getObjectIdentifier($document);
        $this->assertDocumentExists($document);

        return $this->documentLocaleMap[$oid];
    }