You are here

public function XmlSitemapWriter::startElement in XML sitemap 8

Same name and namespace in other branches
  1. 2.x src/XmlSitemapWriter.php \Drupal\xmlsitemap\XmlSitemapWriter::startElement()

Creates start element tag.

Parameters

string $name: Element name.

bool $root: Specify if it is root element or not.

2 calls to XmlSitemapWriter::startElement()
XmlSitemapWriter::startDocument in src/XmlSitemapWriter.php
Starts an XML document.
XmlSitemapWriter::writeElement in src/XmlSitemapWriter.php
Writes full element tag including support for nested elements.

File

src/XmlSitemapWriter.php, line 176

Class

XmlSitemapWriter
Extended class for writing XML sitemap files.

Namespace

Drupal\xmlsitemap

Code

public function startElement($name, $root = FALSE) {
  parent::startElement($name);
  if ($root) {
    foreach ($this
      ->getRootAttributes() as $key => $value) {
      $this
        ->writeAttribute($key, $value);
    }
    $this
      ->writeRaw(PHP_EOL);
  }
}