XML

Validating Your Sitemap

Before you submit a Sitemap to Google for processing, it's a good idea to validate it using a validation tool such as the W3C Validator for XML Schema, which is located at http://www.w3.org/2001/03/webdata/xsv. This online tool allows you to either validate a Sitemap document that you've already posted to the Web or browse for a Sitemap file stored locally on your hard drive. Either way, the Sitemap should be validated against the Google Sitemap XSD Schema, which is located at http://www.google.com/schemas/sitemap/0.84/sitemap.xsd. Refer back to lines 3 and 4 in Listing 20.1 for details on how to reference the XSD schema for a Sitemap in a Sitemap document.

If you're interested in validating a Sitemap index document, make sure you use the appropriate XSD schema: http://www.google.com/schemas/sitemap/0.84/siteindex.xsd.

The W3C Validator for XML Schema allows you to choose between several different output options for the validator but in all likelihood the default option will work fine for you. All you really have to do to use the tool is specify a Sitemap file. In this case, I opted to publish my Sitemap file on the Web. After entering the URL of the file and clicking the Get Results button to initiate the validation process, Figure 20.1 shows the result of a successful validation.

Figure 20.1. Successfully validating a Sitemap document means you're ready to submit it to Google.

If all goes well with the Sitemap validation, you'll see a figure similar to Figure 20.1. If not, the validator will provide you with detailed information about the kinds of errors found and where they are located. You should be able to find the errors in the document and correct them without too much trouble. Make sure you eventually arrive at a file that validates successfully before you move on to submitting the Sitemap to Google.

Validation is an important part of the Sitemap submission process because you'll only be wasting your time if you submit the Sitemap and Google can't process it. Because Google doesn't immediately process Sitemaps, you may not know that the Sitemap failed to process for several hours after submitting it. So, try and make sure to validate your Sitemap documents, especially upon first creating them.