Welcome to WebmasterWorld Guest from 174.129.151.95

Forum Moderators: httpwebwitch

Message Too Old, No Replies

Namespace Error in XML Sitemap

   
7:28 am on Jan 16, 2012 (gmt 0)



Hi,

Please explain me the namespace error in XML sitemaps.
I read but not able to understand.
why this occur, how to resolve this and everything related to it.

Thanks,
Abhishek
2:16 pm on Jan 16, 2012 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member



namespaces are used to define the schema for a node, and they aren't as intuitive as the rest of XML syntax. It all has to do with validation. If it weren't for the need to validate XML according to a schema (DTD), then namespaces wouldn't be needed.

Say you have a schema which uses XML to describe a book. A book has <author>, <isbn>, <pages>, <title>, etc. In XML you can define a namespace for those nodes, so their context is understood. These nodes belong in the namespace of "book".

But you might have another namespace which describes the nodes of a person. <gender>, <firstname>, <age>, <height>, etc. Those nodes belong in the namespace of "person".

So let's say you want to use both of them in the same document. To to that, you'll end up prefixing your nodes with the namespace, like this:

<book:pages>15</book:pages>
<book:title>How to Use Namespaces</book:title>
<person:gender>Male</person:gender>
<person:age>40</person:age>

All HTML pages are namespaced, but you normally can't tell because the default namespace for an HTML document is "html". And the default can be omitted. So we're allowed to use <p>, <b>, <blockquote>... when the syntactically full expression is <html:p>, <html:p>, <html:blockquote>.

The "xmlns" attribute of an XML node lets you define that default, with a link to its DTD:

<html xmlns='http://www.w3.org/1999/xhtml'>
<head><title>Hello World</title></head>...

Namespaces make XML more complicated. Why do they exist?
It's so documents can be validated, when there may be nodes with the same name that have different meanings. For example:

<furniture:table>
<html:table>

<cards:pack>
<camping:pack>
<wolves:pack>

Each of these namespaces have a different meaning for <pack>, so perhaps a <cards:pack> may contain a <cards:card>, while a <wolves:pack> can contain a <wolves:wolf>

this guide will show you how it works...

[w3.org...]

If you're getting an error regarding namespaces, you likely need to either 1) define your namespace with an "xmlns" attribute (often in the root node), or 2) prefix your elements with that namespace.