Skip to content

Commit

Permalink
Merge pull request #110 from spideyfusion/fix-invalid-namespace
Browse files Browse the repository at this point in the history
Fix invalid XML namespace
  • Loading branch information
peter-gribanov authored May 14, 2021
2 parents ddc67fb + e13121b commit aecd491
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Render/PlainTextSitemapRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public function start(): string
' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9'.
' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'.
' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'.
' xmlns:xhtml="https://www.w3.org/1999/xhtml"'.
' xmlns:xhtml="http://www.w3.org/1999/xhtml"'.
'>';
}

return '<?xml version="1.0" encoding="utf-8"?>'.PHP_EOL.
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml">';
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Render/XMLWriterSitemapRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function start(): string
}

$this->writer->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$this->writer->writeAttribute('xmlns:xhtml', 'https://www.w3.org/1999/xhtml');
$this->writer->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');

// XMLWriter expects that we can add more attributes
// we force XMLWriter to set the closing bracket ">"
Expand Down
4 changes: 2 additions & 2 deletions tests/Render/PlainTextSitemapRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getValidating(): array
false,
'<urlset'.
' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'.
' xmlns:xhtml="https://www.w3.org/1999/xhtml"'.
' xmlns:xhtml="http://www.w3.org/1999/xhtml"'.
'>',
],
[
Expand All @@ -47,7 +47,7 @@ public function getValidating(): array
' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9'.
' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'.
' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'.
' xmlns:xhtml="https://www.w3.org/1999/xhtml"'.
' xmlns:xhtml="http://www.w3.org/1999/xhtml"'.
'>',
],
];
Expand Down
4 changes: 2 additions & 2 deletions tests/Render/XMLWriterSitemapRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getValidating(): array
false,
'<urlset'.
' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'.
' xmlns:xhtml="https://www.w3.org/1999/xhtml"'.
' xmlns:xhtml="http://www.w3.org/1999/xhtml"'.
'>',
],
[
Expand All @@ -52,7 +52,7 @@ public function getValidating(): array
' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9'.
' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'.
' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'.
' xmlns:xhtml="https://www.w3.org/1999/xhtml"'.
' xmlns:xhtml="http://www.w3.org/1999/xhtml"'.
'>',
],
];
Expand Down

0 comments on commit aecd491

Please sign in to comment.