I want to know how XML code for site map…
If you’re looking for the rules, make sure if follows this schema
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<xsd:annotation>
<xsd:documentation>
XML Schema for Sitemap files.
Last Modifed 2006-07-25
</xsd:documentation>
</xsd:annotation>
<xsd:element name="urlset">
<xsd:annotation>
<xsd:documentation>
Container for a set of up to 50,000 document elements.
This is the root element of the XML file.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="url" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="url">
<xsd:annotation>
<xsd:documentation>
Container for the data needed to describe a document to crawl.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all>
<xsd:element ref="loc"/>
<xsd:element ref="lastmod" minOccurs="0"/>
<xsd:element ref="changefreq" minOccurs="0"/>
<xsd:element ref="priority" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="loc">
<xsd:annotation>
<xsd:documentation>
REQUIRED: The location URI of a document.
The URI must conform to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt).
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:anyURI">
<xsd:minLength value="12"/>
<xsd:maxLength value="2048"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="lastmod">
<xsd:annotation>
<xsd:documentation>
OPTIONAL: The date the document was last modified. The date must conform
to the W3C DATETIME format (http://www.w3.org/TR/NOTE-datetime).
Example: 2005-05-10
Lastmod may also contain a timestamp.
Example: 2005-05-10T17:33:30+08:00
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="10"/>
<xsd:maxLength value="25"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="changefreq">
<xsd:annotation>
<xsd:documentation>
OPTIONAL: Indicates how frequently the content at a particular URL is
likely to change. The value "always" should be used to describe
documents that change each time they are accessed. The value "never"
should be used to describe archived URLs. Please note that web
crawlers may not necessarily crawl pages marked "always" more often.
Consider this element as a friendly suggestion and not a command.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="always"/>
<xsd:enumeration value="hourly"/>
<xsd:enumeration value="daily"/>
<xsd:enumeration value="weekly"/>
<xsd:enumeration value="monthly"/>
<xsd:enumeration value="yearly"/>
<xsd:enumeration value="never"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="priority">
<xsd:annotation>
<xsd:documentation>
OPTIONAL: The priority of a particular URL relative to other pages
on the same site. The value for this element is a number between
0.0 and 1.0 where 0.0 identifies the lowest priority page(s).
The default priority of a page is 0.5. Priority is used to select
between pages on your site. Setting a priority of 1.0 for all URLs
will not help you, as the relative priority of pages on your site
is what will be considered.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="0.0"/>
<xsd:maxInclusive value="1.0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
If you’re looking to make one, try searching for “sitemap generator”
Mitt’s, may I ask why on earth you’re using XSD to lay out the sitemap when there’s perfectly usable elements for the thing in the specification? That code is hideously bloated and unnecessary considering. If you go by the specification (URL below) you could dump that gnarly file for something better.
Eddie, here’s the sitemap specification, it’s easy to follow (just like writing HTML cept with different tags): http://www.sitemaps.org/protocol.php
It is worked for me - just program small script to include all pages into text file with following scheme:
<?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”>
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com –>
<url>
<loc>http://www.domain1.com/page1.html/</loc>
<lastmod>2010-01-20T17:35:11+00:00</lastmod>
<changefreq>weekly</changefreq>
<priority>1.00</priority>
</url>
<url>
<loc>http://www.domain1.com/page2.html</loc>
<lastmod>2010-01-20T17:35:13+00:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url>
…
</urlset>
Yes, I guess one man’s precise is another man’s gnarly.
Sorry to throw the novel at you when the pamphlet would have been sufficient.
Instead of reinventing the wheel I’d suggest to use already avaialbel tools. As Matt mentioned you can google (e.g. “free xml sitemap generator”) and find quite a few. My personal choice is www.web-site-map.com
How is building a sitemap reinventing the wheel? One of the most absurd statements I’ve read in a while.
Building one manually is so easy there’s no real need for automated tools unless you have thousands of pages to index.
Yup, I do have:) and other people have as well: thousands pages - with constantly changing content.
That is exactly where tools come handy.