/*!
\return the dom document of the package.
19767
function &domStructure()
    {
        $dom = new DOMDocument( '1.0', 'utf-8' );
        $dom->formatOutput = true;
        $root = $dom->createElement( 'package' );
        $root->setAttribute( 'version', eZPackage::VERSION );
        $root->setAttribute( 'development', ( eZPackage::DEVELOPMENT ? 'true' : 'false' ) );
        $dom->appendChild( $root );

        if ( eZPackage::DEVELOPMENT )
        {
            $warningText = "This format was made with a development version and will not work with any release versions.\n" .
                           "The format of this file is also subject to change until the release version.\n" .
                           "Upgrades to the development format will not be supported.";

            $warningNode = $dom->createElement( 'warning' );
            $warningNode->appendChild( $dom->createTextNode( $warningText ) );
            $root->appendChild( $warningNode );
        }

        $name = $this->attribute( 'name' );
        $summary = $this->attribute( 'summary' );
        $description = $this->attribute( 'description' );
        $priority = $this->attribute( 'priority' );
        $type = $this->attribute( 'type' );
        $extension = $this->attribute( 'extension' );
        $installType = $this->attribute( 'install_type' );
        $vendorName = $this->attribute( 'vendor' );
        $source = $this->attribute( 'source' );

        $ezpublishVersion = $this->attribute( 'ezpublish-version' );
        $ezpublishNamedVersion = $this->attribute( 'ezpublish-named-version' );

        $packagingTimestamp = $this->attribute( 'packaging-timestamp' );
        $packagingHost = $this->attribute( 'packaging-host' );
        $packagingPackager = $this->attribute( 'packaging-packager' );

        $maintainers = $this->attribute( 'maintainers' );
        $documents = $this->attribute( 'documents' );
        $groups = $this->attribute( 'groups' );

        $versionNumber = $this->attribute( 'version-number' );
        $releaseNumber = $this->attribute( 'release-number' );
        $releaseTimestamp = $this->attribute( 'release-timestamp' );

        $licence = $this->attribute( 'licence' );
        $state = $this->attribute( 'state' );

        $simpleFileList = $this->attribute( 'simple-file-list' );
        $fileList = $this->attribute( 'file-list' );
        $dependencies = $this->attribute( 'dependencies' );
        $install = $this->attribute( 'install' );
        $uninstall = $this->attribute( 'uninstall' );
        $changelog = $this->attribute( 'changelog' );

        $rootNameTextNode = $dom->createElement( 'name' );
        $rootNameTextNode->appendChild( $dom->createTextNode( $name ) );
        $root->appendChild( $rootNameTextNode );

        if ( $summary )
        {
            $rootSummaryTextNode = $dom->createElement( 'summary' );
            $rootSummaryTextNode->appendChild( $dom->createTextNode( $summary ) );
            $root->appendChild( $rootSummaryTextNode );
        }

        if ( $description )
        {
            $rootDescriptionTextNode = $dom->createElement( 'description' );
            $rootDescriptionTextNode->appendChild( $dom->createTextNode( $description ) );
            $root->appendChild( $rootDescriptionTextNode );
        }

        if ( $vendorName )
        {
            $rootVendorTextNode = $dom->createElement( 'vendor' );
            $rootVendorTextNode->appendChild( $dom->createTextNode( $vendorName ) );
            $root->appendChild( $rootVendorTextNode );
        }

        if ( $priority )
        {
            $rootPriorityTextNode = $dom->createElement( 'priority' );
            $rootPriorityTextNode->setAttribute( 'value', $priority );
            $root->appendChild( $rootPriorityTextNode );
        }

        if ( $type )
        {
            $rootTypeTextNode = $dom->createElement( 'type' );
            $rootTypeTextNode->setAttribute( 'value', $type );
            $root->appendChild( $rootTypeTextNode );
        }

        if ( $extension )
        {
            $rootExtensionTextNode = $dom->createElement( 'extension' );
            $rootExtensionTextNode->setAttribute( 'name', $extension );
            $root->appendChild( $rootExtensionTextNode );
        }

        if ( $source )
        {
            $rootSourceTextNode = $dom->createElement( 'source' );
            $rootSourceTextNode->appendChild( $dom->createTextNode( $source ) );
            $root->appendChild( $rootSourceTextNode );
        }

        $root->setAttribute( 'install_type', $installType );

        $ezpublishNode = $dom->createElement( 'ezpublish' );

        $ezpublishVersionTextNode = $dom->createElement( 'version' );
        $ezpublishVersionTextNode->appendChild( $dom->createTextNode( $ezpublishVersion ) );
        $ezpublishNode->appendChild( $ezpublishVersionTextNode );

        $ezpublishNamedVersionTextNode = $dom->createElement( 'named-version' );
        $ezpublishNamedVersionTextNode->appendChild( $dom->createTextNode( $ezpublishNamedVersion ) );
        $ezpublishNode->appendChild( $ezpublishNamedVersionTextNode );

        $root->appendChild( $ezpublishNode );

        if ( count( $maintainers ) > 0 )
        {
            $maintainersNode = $dom->createElement( 'maintainers' );
            foreach ( $maintainers as $maintainer )
            {
                unset( $maintainerNode );
                $maintainerNode = $dom->createElement( 'maintainer' );

                unset( $maintainerName );
                $maintainerName = $dom->createElement( 'name' );
                $maintainerName->appendChild( $dom->createTextNode( $maintainer['name'] ) );
                $maintainerNode->appendChild( $maintainerName );

                unset( $maintainerEmail );
                $maintainerEmail = $dom->createElement( 'email' );
                $maintainerEmail->appendChild( $dom->createTextNode( $maintainer['email'] ) );
                $maintainerNode->appendChild( $maintainerEmail );
                if ( $maintainer['role'] )
                {
                    unset( $maintainerRole );
                    $maintainerRole = $dom->createElement( 'role' );
                    $maintainerRole->appendChild( $dom->createTextNode( $maintainer['role'] ) );
                    $maintainerNode->appendChild( $maintainerRole );
                }

                $maintainersNode->appendChild( $maintainerNode );
            }
            $root->appendChild( $maintainersNode );
        }

        $packagingNode = $dom->createElement( 'packaging' );

        $packagingTimestampNode = $dom->createElement( 'timestamp' );
        $packagingTimestampNode->appendChild( $dom->createTextNode( $packagingTimestamp ) );
        $packagingNode->appendChild( $packagingTimestampNode );

        $packagingHostNode = $dom->createElement( 'host' );
        $packagingHostNode->appendChild( $dom->createTextNode( $packagingHost ) );
        $packagingNode->appendChild( $packagingHostNode );
        if ( $packagingPackager )
        {
            $packagingPackagerNode = $dom->createElement( 'packager' );
            $packagingPackagerNode->appendChild( $dom->createTextNode( $packagingPackager ) );
            $packagingNode->appendChild( $packagingPackagerNode );
        }

        $root->appendChild( $packagingNode );

        if ( count( $documents ) > 0 )
        {
            $documentsNode = $dom->createElement( 'documents' );
            foreach ( $documents as $document )
            {
                unset( $documentNode );
                $documentNode = $dom->createElement( 'document' );
                $documentNode->setAttribute( 'mime-type', $document['mime-type'] );
                $documentNode->setAttribute( 'name', $document['name'] );
                if ( $document['os'] )
                    $documentNode->setAttribute( 'os', $document['os'] );

                if ( $document['audience'] )
                    $documentNode->setAttribute( 'audience', $document['audience'] );

                $documentsNode->appendChild( $documentNode );
            }
            $root->appendChild( $documentsNode );
        }

        if ( count( $groups ) > 0 )
        {
            $groupsNode = $dom->createElement( 'groups' );
            foreach ( $groups as $group )
            {
                unset( $groupNode );
                $groupNode = $dom->createElement( 'group' );
                $groupNode->setAttribute( 'name', $group['name'] );
                $groupsNode->appendChild( $groupNode );
            }
            $root->appendChild( $groupsNode );
        }

        if ( count( $changelog ) > 0 )
        {
            $changelogNode = $dom->createElement( 'changelog' );
            foreach ( $changelog as $changeEntry )
            {
                unset( $changeEntryNode );
                $changeEntryNode = $dom->createElement( 'entry' );
                $changeEntryNode->setAttribute( 'timestamp', $changeEntry['timestamp'] );
                $changeEntryNode->setAttribute( 'person', $changeEntry['person'] );
                $changeEntryNode->setAttribute( 'email', $changeEntry['email'] );
                $changeEntryNode->setAttribute( 'release', $changeEntry['release'] );

                foreach ( $changeEntry['changes'] as $change )
                {
                    unset( $changeEntryChange );
                    $changeEntryChange = $dom->createElement( 'change' );
                    $changeEntryChange->appendChild( $dom->createTextNode( $change ) );
                    $changeEntryNode->appendChild( $changeEntryChange );
                }
                $changelogNode->appendChild( $changeEntryNode );
            }
            $root->appendChild( $changelogNode );
        }

        // Avoid a PHP warning if 'simple-file-list' is not an array
        if ( is_array( $this->Parameters['simple-file-list'] ) )
        {
            $rootSimpleFiles = $dom->createElement( 'simple-files' );
            foreach( $this->Parameters['simple-file-list'] as $key => $value )
            {
                $simpleFileNode = $dom->createElement( 'simple-file' );
                $simpleFileNode->setAttribute( 'key', $key );
                $simpleFileNode->setAttribute( 'original-path', $value['original-path'] );
                $simpleFileNode->setAttribute( 'package-path', $value['package-path'] );
                $rootSimpleFiles->appendChild( $simpleFileNode );
                unset( $simpleFileNode );
            }
            $root->appendChild( $rootSimpleFiles );
        }
        else
        {
            $rootSimpleFiles = $dom->createElement( 'simple-files' );
            $root->appendChild( $rootSimpleFiles );
        }

        // Handle files
        $filesNode = $dom->createElement( 'files' );

        $hasFileItems = false;
        foreach ( $fileList as $fileCollectionName => $fileCollection )
        {
            if ( count( $fileCollection ) > 0 )
            {
                $hasFileItems = true;

                unset( $fileCollectionNode );
                $fileCollectionNode = $dom->createElement( 'collection' );
                $fileCollectionNode->setAttribute( 'name', $fileCollectionName );

                unset( $fileLists );
                unset( $fileDesignLists );
                unset( $fileThumbnailLists );
                $fileList = array();
                $fileDesignList = array();
                $fileINIList = array();
                $fileThumbnailList = array();
                $fileListNode = null;
                foreach ( $fileCollection as $fileItem )
                {
                    if ( $fileItem['type'] == 'design' )
                        $fileListNode =& $fileDesignLists[$fileItem['design']][$fileItem['role']][$fileItem['role-value']][$fileItem['variable-name']];
                    else if ( $fileItem['type'] == 'ini' )
                        $fileListNode =& $fileINILists[$fileItem['role']][$fileItem['role-value']][$fileItem['variable-name']];
                    else if ( $fileItem['type'] == 'thumbnail' )
                        $fileListNode =& $fileThumbnailLists[$fileItem['role']];
                    else
                        $fileListNode =& $fileLists[$fileItem['type']][$fileItem['role']][$fileItem['role-value']][$fileItem['variable-name']];

                    if ( !$fileListNode ||
                         $fileListNode->getAttribute( 'type' ) != $fileItem['type'] ||
                         $fileListNode->getAttribute( 'role' ) != $fileItem['role'] ||
                         $fileListNode->getAttribute( 'role-value' ) != $fileItem['role-value'] ||
                         $fileListNode->getAttribute( 'variable-name' ) != $fileItem['variable-name'] )
                    {
                        unset( $fileListNode );
                        $fileListNode = $dom->createElement( 'file-list' );
                        $fileListNode->setAttribute( 'type', $fileItem['type'] );

                        if ( $fileItem['type'] == 'design' )
                            $fileListNode->setAttribute( 'design', $fileItem['design'] );
                        if ( $fileItem['role'] )
                            $fileListNode->setAttribute( 'role', $fileItem['role'] );
                        if ( $fileItem['role-value'] )
                            $fileListNode->setAttribute( 'role-value', $fileItem['role-value'] );
                        if ( $fileItem['variable-name'] )
                            $fileListNode->setAttribute( 'variable-name', $fileItem['variable-name'] );

                        $fileCollectionNode->appendChild( $fileListNode );
                    }

                    if ( $fileItem['name'] )
                    {
                        unset( $fileListFile );
                        $fileListFile = $dom->createElement( 'file' );
                        $fileListFile->setAttribute( 'path', $fileItem['path'] );
                        $fileListFile->setAttribute( 'name', $fileItem['name'] );

                        if ( $fileItem['md5'] )
                            $fileListFile->setAttribute( 'md5sum', $fileItem['md5'] );

                        if ( $fileItem['subdirectory'] )
                            $fileListFile->setAttribute( 'sub-directory', $fileItem['subdirectory'] );

                        $fileListNode->appendChild( $fileListFile );
                    }
                }
                $filesNode->appendChild( $fileCollectionNode );
            }
        }
        if ( $hasFileItems )
            $root->appendChild( $filesNode );

        $versionNode = $dom->createElement( 'version' );
        $versionNumberTextNode = $dom->createElement( 'number' );
        $versionNumberTextNode->appendChild( $dom->createTextNode( $versionNumber ) );
        $versionNode->appendChild( $versionNumberTextNode );
        $versionReleaseNumberTextNode = $dom->createElement( 'release' );
        $versionReleaseNumberTextNode->appendChild( $dom->createTextNode( $releaseNumber ) );
        $versionNode->appendChild( $versionReleaseNumberTextNode );
        $root->appendChild( $versionNode );

        if ( $releaseTimestamp )
        {
            $rootTimestampTextNode = $dom->createElement( 'timestamp' );
            $rootTimestampTextNode->appendChild( $dom->createTextNode( $releaseTimestamp ) );
            $root->appendChild( $rootTimestampTextNode );
        }

        if ( $licence )
        {
            $rootLicenceTextNode = $dom->createElement( 'licence' );
            $rootLicenceTextNode->appendChild( $dom->createTextNode( $licence ) );
            $root->appendChild( $rootLicenceTextNode );
        }

        if ( $state )
        {
            $rootStateTextNode = $dom->createElement( 'state' );
            $rootStateTextNode->appendChild( $dom->createTextNode( $state ) );
            $root->appendChild( $rootStateTextNode );
        }

        $dependencyNode = $dom->createElement( 'dependencies' );

        $providesNode = $dom->createElement( 'provides' );
        $dependencyNode->appendChild( $providesNode );
        $requiresNode = $dom->createElement( 'requires' );
        $dependencyNode->appendChild( $requiresNode );
        $obsoletesNode = $dom->createElement( 'obsoletes' );
        $dependencyNode->appendChild( $obsoletesNode );
        $conflictsNode = $dom->createElement( 'conflicts' );
        $dependencyNode->appendChild( $conflictsNode );

        $this->createDependencyTree( $providesNode, 'provide', $dependencies['provides'] );
        $this->createDependencyTree( $requiresNode, 'require', $dependencies['requires'] );
        $this->createDependencyTree( $obsoletesNode, 'obsolete', $dependencies['obsoletes'] );
        $this->createDependencyTree( $conflictsNode, 'conflict', $dependencies['conflicts'] );

        $root->appendChild( $dependencyNode );

        $installNode = $dom->createElement( 'install' );

        $uninstallNode = $dom->createElement( 'uninstall' );

        $this->createInstallTree( $installNode, $dom, $install, 'install' );
        $this->createInstallTree( $uninstallNode, $dom, $uninstall, 'uninstall' );

        $root->appendChild( $installNode );
        $root->appendChild( $uninstallNode );

        if ( count( $this->InstallData ) > 0 )
        {
            $installDataNode = $dom->createElement( 'install-data' );
            foreach ( $this->InstallData as $installDataType => $installData )
            {
                if ( count( $installData ) > 0 )
                {
                    unset( $dataNode );
                    $dataNode = $dom->createElement( 'data' );
                    $dataNode->setAttribute( 'type', $installDataType );
                    $installDataNode->appendChild( $dataNode );
                    foreach ( $installData as $installDataName => $installDataValue )
                    {
                        if ( is_array( $installDataValue ) )
                        {
                            unset( $dataArrayNode );
                            $dataArrayNode = $dom->createElement( 'array' );
                            $dataArrayNode->setAttribute( 'name', $installDataName );
                            $dataNode->appendChild( $dataArrayNode );
                            foreach ( $installDataValue as $installDataValueName => $installDataValueValue )
                            {
                                unset( $dataArrayElement );
                                $dataArrayElement = $dom->createElement( 'element' );
                                $dataArrayElement->setAttribute( 'name', $installDataValueName );
                                $dataArrayElement->setAttribute( 'value', $installDataValueValue );
                                $dataArrayNode->appendChild( $dataArrayElement );
                            }
                        }
                        else
                        {
                            unset( $dataArrayElement );
                            $dataArrayElement = $dom->createElement( 'element' );
                            $dataArrayElement->setAttribute( 'name', $installDataName );
                            $dataArrayElement->setAttribute( 'value', $installDataValue );
                            $dataNode->appendChild( $dataArrayElement );
                        }
                    }
                }
            }
            $root->appendChild( $installDataNode );
        }

        return $dom;
    }
966582
public function getHTML()
    {
        $details = $this->getHTMLDetails();
        extract($details);
        
        $options = null;
        foreach ($this['options'] as $optValue => $optText) {
            $options .= "<option value='{$optValue}'"
                . (($this['value'] == $optValue)
                    ? " selected=\"selected\""
                    : null)
                . ">{$optText}</option>\n";
        }

        return <<<EOD
<p>
<label for='$id'>$label</label>$brAfterLabel
<select id='$id'{$class}{$name}{$autofocus}{$required}{$readonly}{$checked}{$title}>
{$options}
</select>
{$messages}
</p>
<p class='cf-desc'>{$description}</p>
EOD;
    }
898377
protected function getDocument(): Iterator
    {
        if (70400 > PHP_VERSION_ID && '' === $this->escape) {
            $this->document->setCsvControl($this->delimiter, $this->enclosure);

            return EmptyEscapeParser::parse($this->document);
        }

        $this->document->setFlags(SplFileObject::READ_CSV | SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);
        $this->document->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
        $this->document->rewind();

        return $this->document;
    }
1003974
function serializeContentObjectAttribute( $package, $objectAttribute )
    {
        $node = $this->createContentObjectAttributeDOMNode( $objectAttribute );
        $dom = $node->ownerDocument;

        $url = eZURL::fetch( $objectAttribute->attribute( 'data_int' ) );
        if ( is_object( $url ) and
             trim( $url->attribute( 'url' ) ) != '' )
        {
            $urlNode = $dom->createElement( 'url' );
            $urlNode->appendChild( $dom->createTextNode( urlencode( $url->attribute( 'url' ) ) ) );
            $urlNode->setAttribute( 'original-url-md5', $url->attribute( 'original_url_md5' ) );
            $urlNode->setAttribute( 'is-valid', $url->attribute( 'is_valid' ) );
            $urlNode->setAttribute( 'last-checked', $url->attribute( 'last_checked' ) );
            $urlNode->setAttribute( 'created', $url->attribute( 'created' ) );
            $urlNode->setAttribute( 'modified', $url->attribute( 'modified' ) );
            $node->appendChild( $urlNode );
        }

        if ( $objectAttribute->attribute( 'data_text' ) )
        {
            $textNode = $dom->createElement( 'text' );
            $textNode->appendChild( $dom->createTextNode( $objectAttribute->attribute( 'data_text' ) ) );
            $node->appendChild( $textNode );
        }

        return $node;
    }
962370
def doc(self):
        """"""
        return self._pv.doc or inspect.getdoc(
            getattr(type(self._target), self._pv.property, None)) or ''
741112
protected function getContent()
    {
        $dom = new DOMDocument('1.0');
        $dom->loadXML($this->string);
        $dom->preserveWhiteSpace = false;
        $dom->formatOutput = true;

        return $dom->saveXML();
    }
1251130
public function toDOM(\DOMDocument $doc): \DOMNode
    {
        $paragraph = $doc->createElement('p');

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

        return $paragraph;
    }
153417
static function fetchFromFile( $filename )
    {
        $dom = eZPackage::fetchDOMFromFile( $filename );

        if ( $dom === false )
        {
            return false;
        }

        $package = new eZPackage();
        $parameters = $package->parseDOMTree( $dom );
        if ( !$parameters )
        {
            return false;
        }

        return $package;
    }
1177660
private static function getCleanedHTML(DOMDocument $doc, $container)
    {
        while ($doc->firstChild) {
            $doc->removeChild($doc->firstChild);
        }

        while ($container->firstChild ) {
            $doc->appendChild($container->firstChild);
        }

        $html = trim($doc->saveHTML());
        return $html;
    }
109396
private function getDomDocument(string $src){
        if(strtolower(substr($src, 0, 14)) !== "<!doctype html"){
            return null;
        }

        $dom    = new \DOMDocument();
        @$dom->loadHTML($src);

        return $dom;
    }
1306577
public function getDocument()
    {
        if ($this->node->ownerDocument === null) {
            return null;
        }

        return new Document($this->node->ownerDocument);
    }
158390
function getiframeDocument($iframe) {
            var iframeDoc = $iframe[0].contentWindow || $iframe[0].contentDocument;
            if (iframeDoc.document) {
                iframeDoc = iframeDoc.document;
            }
            return iframeDoc;
        }
510634
protected function getDocument()
    {
        if (null === $this->document) {
            $this->document = \DOMImplementation::createDocument(
                'http://www.w3.org/1999/xhtml',
                'html',
                \DOMImplementation::createDocumentType(
                    'html',
                    '-//W3C//DTD XHTML 1.0 Strict//EN',
                    'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
                )
            );
        }

        return $this->document;
    }
779460
private function getJS()
    {

        if (strlen($this->JSrenderDocReady . $this->JSrender) == 0) {
            return "";
        }

        $js = "
                    <script type=\"text/javascript\">

                    ";
        if (strlen($this->JSrenderDocReady) > 0) {
            $js .= "   $(document).ready(function()
                        {
                        {$this->JSrenderDocReady}
                        } )
                      ";
        }
        $js .= $this->JSrender . "


                    </script>"
        ;

        return $js;
    }
450082
private function loadStructure(Document $dom)
    {
        $elementtypeStructure = new ElementtypeStructure();

        $nodes = $dom->documentElement->evaluate('structure/node');
        if ($nodes->length) {
            foreach ($nodes as $node) {
                $this->loadNode($node, $elementtypeStructure);
            }
        }

        return $elementtypeStructure;
    }
569957
public function getDOMDocument()
    {
        $node = $this->getNode(0);
        $r = null;
        if ($node instanceof \DOMElement
            && $node->ownerDocument instanceof \DOMDocument
        ) {
            $r = $node->ownerDocument;
        }
        return $r;
    }
132975
function getScriptElements($typeLazy) {
        var scripts;
        var src = $typeLazy.attr("src");
        if ("js" === getExtension(src).toLowerCase()) {
            return $typeLazy;
        } else {
            src = path.join(grunt.config.get('tmpdir'), src);
            if (fs.existsSync(src)) {
                scripts = jsdom.jsdom(fs.readFileSync(src).toString());
                return $(scripts).find("script");
            } else {
                return $();
            }
        }
    }