Возвращает dom документ

@param DomDocumentType $domDocumentType

@return string
@throws  \OldTown\Workflow\Exception\InvalidDtdSchemaException
969076
public function resolveEntity(DOMDocumentType $domDocumentType = null)
    {
        if (null === $domDocumentType) {
            $errMsg = 'Отсутствует DOMDocumentType';
            throw new InvalidDtdSchemaException($errMsg);
        }

        $systemId = $domDocumentType->systemId;

        $uri = static::uriFactory($systemId);

        if (!($this->isOpenSymphonyUrl($uri) && $this->isDtdReference($uri))) {
            $errMsg = sprintf('Некорректный uri doctype: %s', $systemId);
            throw new InvalidDtdSchemaException($errMsg);
        }


        $path = $uri->getPath();

        $dtd = $this->localDtd($path);

        return $dtd;
    }
920597
protected function asXml(DomDocument $document)
    {
        $root = $document->createElement($this->getTagName(), $this->content);
        $document->appendChild($root);

        foreach ($this->attributes as $name => $value) {
            $root->setAttribute($name, $value);
        }

        foreach ($this->children as $child) {
            $root->appendChild($child->asXml($document));
        }

        return $root;
    }
256230
public function entityGetAttrType($demAttrType)
    {
        $result = MageType::COL_TEXT;
        $type = key($demAttrType);
        $typeData = reset($demAttrType);
        switch ($type) {
            case DemType::A_BINARY:
                $result = MageType::COL_BLOB;
                break;
            case DemType::A_BOOLEAN:
                $result = MageType::COL_BOOLEAN;
                break;
            case DemType::A_DATETIME:
                $result = MageType::COL_TIMESTAMP;
                break;
            case DemType::A_INTEGER:
                $result = MageType::COL_INTEGER;
                if (isset($typeData[Cfg::SUBTYPE])) {
                    if ($typeData[Cfg::SUBTYPE] == DemType::ATTRSUB_SMALL_INT) {
                        $result = MageType::COL_SMALLINT;
                    }
                }
                break;
            case DemType::A_NUMERIC:
                $result = MageType::COL_DECIMAL;
                break;
            case DemType::A_OPTION:
                $result = MageType::COL_TEXT;
                break;
            case DemType::A_TEXT:
                $result = MageType::COL_TEXT;
                break;
        }
        return $result;
    }
263415
public function toXML( DOMDocument $dom )
    {
        if ( !$this->XMLStorable )
        {
            return false;
        }

        $itemNode = $dom->createElement( 'item' );

        foreach ( $this->attributes as $attrName => $attrValue )
        {
            switch ( $attrName )
            {
                case 'id':
                    $itemNode->setAttribute( 'id', $attrValue );
                    break;

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

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

        return $itemNode;
    }
928252
public static function doctype($type = 'xhtml1-trans')
	{
		if(static::$doctypes === null)
		{
			\Config::load('doctypes', true);
			static::$doctypes = \Config::get('doctypes', array());
		}

		if(is_array(static::$doctypes) and isset(static::$doctypes[$type]))
		{
			if($type == "html5")
			{
				static::$html5 = true;
			}
			return static::$doctypes[$type];
		}
		else
		{
			return false;
		}
	}
1373092
public function format(\DOMDocument $document) : \DOMDocument
    {
        $rss = $document->createElement(static::ROOT_NODE_TAGNAME);
        $rss->setAttribute('version', static::VERSION);
        $channel = $document->createElement(static::CHANNEL_NODE_TAGNAME);
        $rss->appendChild($channel);
        $document->appendChild($rss);

        return $document;
    }
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;
    }
524365
public function asDom(): \DOMDocument
    {
        $doc = new \DOMDocument();
        $doc->loadXML($this->writer->outputMemory());
        return $doc;
    }
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);
    }
212805
function domString( $domDocument )
    {
        $ini = eZINI::instance();
        $xmlCharset = $ini->variable( 'RegionalSettings', 'ContentXMLCharset' );
        if ( $xmlCharset == 'enabled' )
        {
            $charset = eZTextCodec::internalCharset();
        }
        else if ( $xmlCharset == 'disabled' )
            $charset = true;
        else
            $charset = $xmlCharset;
        if ( $charset !== true )
        {
            $charset = eZCharsetInfo::realCharsetCode( $charset );
        }
        $domString = $domDocument->saveXML();
        return $domString;
    }
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;
    }
798927
public function render(\DOMDocument $domDocument)
    {
        $this->loadFeatures($this->features);

        $scriptXml  = $domDocument->createElement("script");
        $scriptText = $this->buildScriptText();

        $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;
    }
105563
public function validateSchema(\DOMDocument $dom)
    {
        $schemaLocations = ['http://symfony.com/schema/dic/services' => str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd')];

        if ($element = $dom->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')) {
            $items = preg_split('/\s+/', $element);
            for ($i = 0, $nb = \count($items); $i < $nb; $i += 2) {
                if (!$this->container->hasExtension($items[$i])) {
                    continue;
                }

                if (($extension = $this->container->getExtension($items[$i])) && false !== $extension->getXsdValidationBasePath()) {
                    $ns = $extension->getNamespace();
                    $path = str_replace([$ns, str_replace('http://', 'https://', $ns)], str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]);

                    if (!is_file($path)) {
                        throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s"', \get_class($extension), $path));
                    }

                    $schemaLocations[$items[$i]] = $path;
                }
            }
        }

        $tmpfiles = [];
        $imports = '';
        foreach ($schemaLocations as $namespace => $location) {
            $parts = explode('/', $location);
            $locationstart = 'file:///';
            if (0 === stripos($location, 'phar://')) {
                $tmpfile = tempnam(sys_get_temp_dir(), 'symfony');
                if ($tmpfile) {
                    copy($location, $tmpfile);
                    $tmpfiles[] = $tmpfile;
                    $parts = explode('/', str_replace('\\', '/', $tmpfile));
                } else {
                    array_shift($parts);
                    $locationstart = 'phar:///';
                }
            }
            $drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
            $location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));

            $imports .= sprintf('  <xsd:import namespace="%s" schemaLocation="%s" />'."\n", $namespace, $location);
        }

        $source = <<<EOF
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema xmlns="http://symfony.com/schema"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://symfony.com/schema"
    elementFormDefault="qualified">

    <xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
$imports
</xsd:schema>
EOF
        ;

        $disableEntities = libxml_disable_entity_loader(false);
        $valid = @$dom->schemaValidateSource($source);
        libxml_disable_entity_loader($disableEntities);

        foreach ($tmpfiles as $tmpfile) {
            @unlink($tmpfile);
        }

        return $valid;
    }
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;
    }
329615
static function decodeDataTypes( $node, $type = "" )
    {
        $returnValue = false;

        $attributeValue = '';
        $attribute = $node->getAttributeNodeNS( eZSOAPEnvelope::SCHEMA_INSTANCE, 'type' );
        if ( !$attribute )
        {
            $attribute = $node->getAttributeNodeNS( 'http://www.w3.org/1999/XMLSchema-instance', 'type' );
        }
        $attributeValue = $attribute->value;

        $dataType = $type;
        $attrParts = explode( ":", $attributeValue );
        if ( $attrParts[1] )
        {
            $dataType = $attrParts[1];
        }

/*
        $typeNamespacePrefix = $this->DOMDocument->namespaceByAlias( $attrParts[0] );

        check that this is a namespace type definition
                if ( ( $typeNamespacePrefix == eZSOAPEnvelope::SCHEMA_DATA ) ||
                     ( $typeNamespacePrefix == eZSOAPEnvelope::ENC )
                     )
TODO: add encoding checks with schema validation.
*/

        switch ( $dataType )
        {
            case "string" :
            case "int" :
            case "float" :
            case 'double' :
            {
                $returnValue = $node->textContent;
            } break;

            case "boolean" :
            {
                if ( $node->textContent == "true" )
                    $returnValue = true;
                else
                    $returnValue = false;
            } break;

            case "base64" :
            {
                $returnValue = base64_decode( $node->textContent );
            } break;

            case "Array" :
            {
                // Get array type
                $arrayType = $node->getAttributeNodeNS( eZSOAPEnvelope::ENC, 'arrayType' )->value;
                $arrayTypeParts = explode( ":", $arrayType );

                preg_match( "#(.*)\[(.*)\]#",  $arrayTypeParts[1], $matches );

                $type = $matches[1];
                $count = $matches[2];

                $returnValue = array();
                foreach( $node->childNodes as $child )
                {
                    if ( $child instanceof DOMElement )
                    {
                        $returnValue[] = eZSOAPResponse::decodeDataTypes( $child, $type );
                    }
                }
            }break;

            case "SOAPStruct" :
            {
                $returnValue = array();

                foreach( $node->childNodes as $child )
                {
                    if ( $child instanceof DOMElement )
                    {
                        $returnValue[$child->tagName] = eZSOAPResponse::decodeDataTypes( $child );
                    }
                }
            }break;

            default:
            {
                foreach ( $node->childNodes as $childNode )
                {
                    if ( $childNode instanceof DOMElement )
                    {
                        // check data type for child
                        $attr = $childNode->getAttributeNodeNS( eZSOAPEnvelope::SCHEMA_INSTANCE, 'type' )->value;

                        $dataType = false;
                        $attrParts = explode( ":", $attr );
                        $dataType = $attrParts[1];

                        $returnValue[$childNode->tagName] = eZSOAPResponse::decodeDataTypes( $childNode );
                    }
                }

            } break;
        }

        return $returnValue;
    }
262975
public function getXMLDBKeyType($type) {

        $result = XMLDB_KEY_INCORRECT;

        switch (strtolower($type)) {
            case 'primary':
                $result = XMLDB_KEY_PRIMARY;
                break;
            case 'unique':
                $result = XMLDB_KEY_UNIQUE;
                break;
            case 'foreign':
                $result = XMLDB_KEY_FOREIGN;
                break;
            case 'foreign-unique':
                $result = XMLDB_KEY_FOREIGN_UNIQUE;
                break;
            // case 'check':  //Not supported
            //     $result = XMLDB_KEY_CHECK;
            //     break;
        }
        // Return the normalized XMLDB_KEY
        return $result;
    }