简体   繁体   中英

Are the xsi and schema portions needed in an XML sitemap? What do they mean?

For the XML sitemap of my website, I noticed that different articles suggest different things.

For example, prior to my page listings, some articles suggest starting it this way:

  <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 other articles have it layed out using only:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

Do I need to include all of the extra stuff from the first example?

And what exactly is the difference between using the extra parts, or not using them?

You only need to provide the schema if you want to validate the XML against the Sitemaps.org XSD (or if you use some other XML tool making use of it). See Validating your Sitemap .

If you don't need this (and it's likely that you don't, otherwise you probably wouldn't ask), it's sufficient to use

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM