Skip to content

Commit

Permalink
- fix bug in exporting sitemapindex to xml
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberomulus committed May 31, 2015
1 parent 92a1a5d commit f72e635
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
18 changes: 9 additions & 9 deletions README-FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Il suffit d'ajouter la dépendances à votre fichier composer.json:

{
"require": {
"cyberomulus/sitemap-generator": "1.0"
"cyberomulus/sitemap-generator": "~1.0"
}
}

Expand Down Expand Up @@ -175,24 +175,24 @@ Le résultat :
Le résultat :

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://www.test.com/sitemap1.xml</loc>
<lastmod>2015-05-17T15:07:40+02:00</lastmod>
<changefreq>always</changefreq>
<priority>0.5</priority>
</url>
<url>
</sitemap>
<sitemap>
<loc>http://www.test.com/sitemap1.xml</loc>
<lastmod>2015-05-17T15:07:40+02:00</lastmod>
<changefreq>never</changefreq>
</url>
<url>
</sitemap>
<sitemap>
<loc>http://www.test.com/sitemap.php?code=3&amp;amp;restet=super</loc>
<lastmod>2015-05-17T15:07:40+02:00</lastmod>
<changefreq>never</changefreq>
</url>
</urlset>
</sitemap>
</sitemapindex>

## Sous quelle licence est SiteMapGenerator
SiteMapGenerator est sous licence MIT (licence libre).
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Just add the dependencies to your composer.json:

{
"require": {
"cyberomulus/sitemap-generator": "1.0"
"cyberomulus/sitemap-generator": "~1.0"
}
}

Expand Down Expand Up @@ -173,24 +173,24 @@ The result :
The result :

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://www.test.com/sitemap1.xml</loc>
<lastmod>2015-05-17T15:07:40+02:00</lastmod>
<changefreq>always</changefreq>
<priority>0.5</priority>
</url>
<url>
</sitemap>
<sitemap>
<loc>http://www.test.com/sitemap1.xml</loc>
<lastmod>2015-05-17T15:07:40+02:00</lastmod>
<changefreq>never</changefreq>
</url>
<url>
</sitemap>
<sitemap>
<loc>http://www.test.com/sitemap.php?code=3&amp;amp;restet=super</loc>
<lastmod>2015-05-17T15:07:40+02:00</lastmod>
<changefreq>never</changefreq>
</url>
</urlset>
</sitemap>
</sitemapindex>

## What license is SiteMapGenerator
SiteMapGenerator is under MIT license (license free).
Expand Down
4 changes: 2 additions & 2 deletions src/Formatter/XMLFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ public function formatSiteMapIndex(SiteMapIndex $siteMapIndex)
$writer->startDocument("1.0", "UTF-8");

// start root
$writer->startElementNs(null, "urlset", "http://www.sitemaps.org/schemas/sitemap/0.9");
$writer->startElementNs(null, "sitemapindex", "http://www.sitemaps.org/schemas/sitemap/0.9");

// add all url's entries
foreach ($siteMapIndex->getSiteMapEntries() as $siteMapEntry)
{
if ($siteMapEntry->getUrl() != null)
{
$writer->startElement("url");
$writer->startElement("sitemap");
$writer->writeElement("loc", htmlentities($siteMapEntry->getUrl(), null, "UTF-8", true));

if ($siteMapEntry->getLastModification())
Expand Down

0 comments on commit f72e635

Please sign in to comment.