|Namespace Error in XML Sitemap|
| 7:28 am on Jan 16, 2012 (gmt 0)|
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.
| 2:16 pm on Jan 16, 2012 (gmt 0)|
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:title>How to Use Namespaces</book:title>
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:
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:
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...
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.