The opening tag for the sitemap is the following:

<?xml version="1.0" encoding="UTF-8"?>'."\n");
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

while the required one is simply:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

To notice that the used opening tag doesn't contain a closing quotation mark too (xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9).

Comments

avpaderno’s picture

I didn't remove some characters that belong to the line that calls fwrite().

The currently used opening tag is the following:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
dave reid’s picture

The missing closing quotation mark is by design, otherwise it will not properly validate.

avpaderno’s picture

Title: Opening tag for the sitemap contains more data than required, and misses a closing quotation mark » Opening tag for the sitemap contains more data than required
Category: bug » task

Then, the opening tag simply contains more data than the sitemap protocol suggests to use.

avpaderno’s picture

That is also true for the sitemap chunk opening tag.

Anonymous’s picture

Priority: Normal » Minor

I'm not too concerned that too much information is in the tag. Can you give a sample of why this shouldn't be specified?

avpaderno’s picture

Check the sitemap protocol, and what the opening tag they use; as that is the official documentation, the format they report should be the followed one.

dave reid’s picture

@Kiam/6:

Please see http://sitemaps.org/protocol.php#validating:

<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9"
         url="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
         xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      ...
   </url>
</urlset>

FYI, the example in the protocol is wrong, that's why we have the one line that doesn't end with a quotation.

avpaderno’s picture

http://sitemap.org/protocol.php clearly report the following example of sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://www.example.com/</loc>
      <lastmod>2005-01-01</lastmod>
      <changefreq>monthly</changefreq>
      <priority>0.8</priority>
   </url>
</urlset>

Leaving out the missing quotation mark, which is not really missing, but it's present on the next line, the example uses an opening tag that is <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">. It doesn't add any other attribute, if not the one specifying the XML namespace.

I changed the issue title, which is now focused on the extra data given, which are not necessary, nor mandatory, as reported from the sitemap protocol.

Anonymous’s picture

Right, it is an example and not the only one to use.

Anonymous’s picture

Status: Active » Postponed
Issue tags: +proof of issue
avpaderno’s picture

Also Google Webmasters Tools reports the opening tag to require only the namespace attribute; I am not sure about Windows Live, but I think they report the same thing.

avpaderno’s picture

See also Manually creating a Sitemap.

Anyway, the sitemap protocol doesn't give an example, but it reports what the protocol for the sitemap is.

Anonymous’s picture

And from the sitemap protocol you reference (sic):

 Sitemap:

<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9"
         url="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
         xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      ...
   </url>
</urlset>

Sitemap index file:

<?xml version='1.0' encoding='UTF-8'?>
<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9"
         url="http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"
         xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      ...
   </sitemap>
</sitemapindex>
avpaderno’s picture

I don't know where you look at, but the first sitemaps sample I see are the following:

Sample XML Sitemap
The following example shows a Sitemap that contains just one URL and uses all optional tags. The optional tags are in italics.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://www.example.com/</loc>
      <lastmod>2005-01-01</lastmod>
      <changefreq>monthly</changefreq>
      <priority>0.8</priority>
   </url>
</urlset> 

Sample XML Sitemap
The following example shows a Sitemap in XML format. The Sitemap in the example contains a small number of URLs, each using a different set of optional parameters.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://www.example.com/</loc>
      <lastmod>2005-01-01</lastmod>
      <changefreq>monthly</changefreq>
      <priority>0.8</priority>
   </url>
   <url>
      <loc>http://www.example.com/catalog?item=12&amp;desc=vacation_hawaii</loc>
      <changefreq>weekly</changefreq>
   </url>
   <url>
      <loc>http://www.example.com/catalog?item=73&amp;desc=vacation_new_zealand</loc>
      <lastmod>2004-12-23</lastmod>
      <changefreq>weekly</changefreq>
   </url>
   <url>
      <loc>http://www.example.com/catalog?item=74&amp;desc=vacation_newfoundland</loc>
      <lastmod>2004-12-23T18:00:15+00:00</lastmod>
      <priority>0.3</priority>
   </url>
   <url>
      <loc>http://www.example.com/catalog?item=83&amp;desc=vacation_usa</loc>
      <lastmod>2004-11-23</lastmod>
   </url>
</urlset>

Sample XML Sitemap Index
The following example shows a Sitemap index that lists two Sitemaps:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>http://www.example.com/sitemap1.xml.gz</loc>
      <lastmod>2004-10-01T18:23:17+00:00</lastmod>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap2.xml.gz</loc>
      <lastmod>2005-01-01</lastmod>
   </sitemap>
</sitemapindex>

Out of 5 reported examples (including yours), 4 examples use only the XML namespace attribute.

avpaderno’s picture

If then we look at what the 6.2 branch does, it uses the simplified tag definition. I take it as Dave agrees with me on using the simplified version of the opening tag.

avpaderno’s picture

There is also an evident reason to not add the extra attributes in the opening tag.

Anonymous’s picture

Status: Postponed » Closed (won't fix)
avpaderno’s picture

The reason to not add the additional attributes is that the search engines do not need to validate the XML content because they know the sitemap format.