A namespace declaration that specifies a prefix (e.g., xmlns:foo="urn:foo.bar") allows you to refer to that namespace by its declared prefix ("foo"). A namespace declaration that does not specify a prefix ( e.g. xmlns="urn:foo.bar") establishes a default namespace. Any element within the scope of such a declaration that does not specify a prefix is assumed to be in the default namespace. If you have an element that does not have a qualified name, then you must override the default namespace.

For example, lets assume that we have an element called "foo" that is in the "urn:foo.bar" namespace, and it has a child element called "bar", which is a local element to "foo" and therefore is in no namespace. You could represent it like so:

<tns:foo xmlns:tns="urn:foo.bar">
   <bar>foobar</bar>
</tns:foo>

or

<foo xmlns="urn:foo.bar">
   <bar xmlns="">foobar</bar>
</foo>

but this would not be valid:

<foo xmlns="urn:foo.bar">
   <bar>foobar</bar>
</foo>

Anne

On 4/19/06, Daniel Destro <[EMAIL PROTECTED]> wrote:
What is the difference between the two namespaces

xmlns="urn:SacSilog"

and

xmlns:ns1="urn:SacSilog">

Why one or other?

thanks


Reply via email to