Build sitemap xml

@return  string
551473
public function main()
    {
        // INIT
        $this->tsSetup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['sitemap.'];

        // check if sitemap is enabled in root
        if (!GeneralUtility::getRootSettingValue('is_sitemap', true)) {
            $this->showError('Sitemap is not available, please check your configuration [control-center]');
        }

        return $this->build();
    }
151596
public function asXML()
    {
        $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item></item>',
            LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL);
        $xml->addChild('title', $this->title);
        $xml->addChild('link', $this->url);
        if ($this->pubDate !== null) {
            $xml->addChild('pubDate', date(DATE_RSS, $this->pubDate));
        }

        if ($this->creator) {
            $xml->addChildCData("xmlns:dc:creator", $this->creator);
        }
        if ($this->guid) {
            $guid = $xml->addChild('guid', $this->guid);

            if ($this->isPermalink === false) {
                $guid->addAttribute('isPermaLink', 'false');
            }
        }

        foreach ($this->categories as $category) {
            $element = $xml->addChild('category', $category[0]);

            if (isset($category[1])) {
                $element->addAttribute('domain', $category[1]);
            }
        }

        $xml->addChild('description', $this->description);
        if(strlen(trim($this->content)) > 0) {
            $xml->addChildCData('xmlns:content:encoded', $this->content);
        }

        if (is_array($this->enclosure) && (count($this->enclosure) == 3)) {
            $element = $xml->addChild('enclosure');
            $element->addAttribute('url', $this->enclosure['url']);
            $element->addAttribute('type', $this->enclosure['type']);

            if ($this->enclosure['length']) {
                $element->addAttribute('length', $this->enclosure['length']);
            }
        }

        return $xml;
    }
590010
public function createUpdateXML() {
    $doc = $this->createDocument();

    $root = $doc->appendChild($doc->createElement($this->getNodeName()));

    foreach ($this->getUpdatableAttributes() as $attr) {
      $val = $this->$attr;

      if ($val instanceof DateTime) {
        $val = $val->format('c');
      }

      $root->appendChild($doc->createElement($attr, $val));
    }

    return $this->renderXML($doc);
  }
330263
public function sitemapAction()
    {
        /* @var ContentInterface[] $content */
        $contents = $this->get('opifer.content.content_manager')->getRepository()->findIndexable();

        $event = new SitemapEvent();

        foreach ($contents as $content) {
            $event->addUrl($this->generateUrl('_content', ['slug' => $content->getSlug()], UrlGeneratorInterface::ABSOLUTE_URL), $content->getUpdatedAt());
        }

        $dispatcher = $this->get('event_dispatcher');
        $dispatcher->dispatch(Events::POPULATE_SITEMAP, $event);

        return $this->render('OpiferCmsBundle:Sitemap:sitemap.xml.twig', [
            'urls' => $event->getUrls(),
        ]);
    }
301666
def as_xml(self):
        
        self.default_capability()
        s = self.new_sitemap()
        return s.resources_as_xml(self, sitemapindex=self.sitemapindex)
1152614
private function displayXML($menus)
    {
        $treeList = [];
        $manager  = $this->getTreeManager();

        /** @var \MakinaCorpus\Umenu\Menu $menu */
        foreach ($menus as $menu) {
            $tree = $manager->buildTree($menu->getId(), true);
            if (!$tree->isEmpty()) {
                $treeList[] = $tree;
            }
        }

        $output = $this->renderView('@ucms_seo/views/sitemap.xml.twig', ['menus_tree' => $treeList]);

        return new Response($output, 200, ['content-type' => 'application/xml']);
    }
937243
public function getSitemaps()
    {
        if (empty($this->sitemap)) {
            $this->log[] = self::DIRECTIVE_SITEMAP . ' directive: No sitemaps found';
        }
        return $this->sitemap;
    }
545899
protected function buildXml()
	{
		$buffer = array();

		$buffer[] = '<?xml version="1.0"?>';
		$buffer[] = '<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
		$buffer[] = ' <database name="">';

		$buffer = array_merge($buffer, $this->buildXmlStructure());

		$buffer[] = ' </database>';
		$buffer[] = '</mysqldump>';

		return implode("\n", $buffer);
	}
465576
public function getSiteMap()
    {
        $sitemap = $this->getCacheItem('site-map');

        if (null === $sitemap) {
            /* @var $menuService MenuService */
            $menuService = $this->getService(MenuService::class);

            $navigation = $menuService->getPages();

            $argv = $this->prepareEventArguments(compact('navigation'));
            $this->getEventManager()->trigger('uthando.site-map', $this, $argv);

            $sitemap = $this->getService('ViewHelperManager')
                ->get(Navigation::class)
                ->setRole('guest')
                ->sitemap($navigation)
                ->render();

            $this->setCacheItem('site-map', $sitemap);
        }

        return $sitemap;
    }
851527
public function to_xml() {
        $this->validate();
        foreach ($this->entries as $entry) {
            $entry->id = 'portfolio:' . $entry->id;
            $this->feed->appendChild($entry->to_dom($this->dom, $this->user));
        }
        return $this->dom->saveXML();
    }
825148
protected function build()
    {
        $page = Typo3GeneralUtility::_GP('page');

        /** @var \Metaseo\Metaseo\Sitemap\Generator\XmlGenerator $generator */
        $generator = $this->objectManager->get('Metaseo\\Metaseo\\Sitemap\\Generator\\XmlGenerator');

        if (empty($page) || $page === 'index') {
            return $generator->sitemapIndex();
        } else {
            return $generator->sitemap($page);
        }
    }
1340311
private function xml() {
    	$document = new DOMDocument('1.0', 'UTF-8');
    	$document->appendChild($this->buildElement($this, $document));
    	return $document;
    }
105655
public static function buildSitemap( $links, $baseUrl = "" )
	{
		$root	= new XML_DOM_Node( "urlset" );
		$root->setAttribute( 'xmlns', "http://www.google.com/schemas/sitemap/0.84" );
		foreach( $links as $link )
		{
			$child	= new XML_DOM_Node( "url" );
			$loc	= new XML_DOM_Node( "loc", $baseUrl.$link );
			$child->addChild( $loc );
			$root->addChild( $child );
		}
		$builder	= new XML_DOM_Builder();
		return $builder->build( $root );
	}
2285
public function serializeToXml()
    {
        $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><WebsiteConfiguration></WebsiteConfiguration>');
        $index_document_part = $xml->addChild('IndexDocument');
        $error_document_part = $xml->addChild('ErrorDocument');
        $index_document_part->addChild('Suffix', $this->indexDocument);
        $error_document_part->addChild('Key', $this->errorDocument);
        return $xml->asXML();
    }
795762
public function getOutputFilename()
    {
        $result = $this->outputFilename;
        if ($result === '') {
            $config = $this->app->make('config');
            $relativeName = '/' . ltrim(str_replace(DIRECTORY_SEPARATOR, '/', (string) $config->get('concrete.sitemap_xml.file')), '/');
            if ($relativeName === '/') {
                $relativeName = '/sitemap.xml';
            }
            $result = rtrim(DIR_BASE, '/') . $relativeName;
        }

        return $result;
    }
1178325
private function buildXmlSourceView()
	{
		$filename = '../include/demos/'.mb_strtolower($this->demo).'.xml';
		if (file_exists($filename)) {
			$this->layout_ui->getWidget('xml_source_container')->visible = true;

			$code = file_get_contents($filename);
			$code = str_replace("\t", '  ', $code);
			$code = highlight_string($code, true);

			$pre_tag = new SwatHtmlTag('pre');
			$pre_tag->setContent($code, 'text/xml');

			$this->layout_ui->getWidget('xml_source_view')->content =
				$pre_tag->toString();
		}
	}
522813
protected function getContent()
    {
        $this->currentURL = $this->urlEncode($this->currentURL);
        if (!$this->urlValidate($this->currentURL)) {
            throw new SitemapParserException('Invalid URL');
        }
        try {
            if (!isset($this->config['guzzle']['headers']['User-Agent'])) {
                $this->config['guzzle']['headers']['User-Agent'] = $this->userAgent;
            }
            $client = new GuzzleHttp\Client();
            $res = $client->request('GET', $this->currentURL, $this->config['guzzle']);
            return $res->getBody();
        } catch (GuzzleHttp\Exception\TransferException $e) {
            throw new SitemapParserException($e->getMessage());
        }
    }