Unqualified elements , are automatically in the default name space , while those with the name space prefix use the namespace as per the qualification. the difference is really only between the fact that one is implicit the other is explicit
K.P.Thottam (K.P.T)<br /> <br />Sun Certified Enterprise Architect,TOGAF 8 Certified,Certified Information System security Professional (CISSP),SCJDWS,SCWCD,SCJP,MCP
Joined: Jun 29, 2001
ignore the posting earlier , I was not thinking , need some coffee
targetNamespace is the namespace that is going to be assigned to the schema you are creating. It is the namespace an instance is going to use to access the types it declares. In the following code, the schema will be assigned to the namespace http://www.Monson-Haefel.com/jswbook/po
In an XML document instance, you declare the namespaces you are going to be using by means of the xmlns attribute. For example:
The default namespace here is http://www.Monson-Haefel.com/jswbook/po, which makes reference to the schema previously created. This namespace applies to the element that declares it, and its child elements, unles they are prefixed. In the example, all the elements belong to the default namespace, except addr:street. Since it is prefixed, it belongs to the addr namespace (xmlns:addr="http://www.Monson-Haefel.com/jwsbook/addr")
An XML namespace gives the types defined in and XML schema a unique name - kind of like a sir name. In the US there are probably 10 million people named "John" so we use Sir names like "Smith" and middle names like "William" to distinguish one "John" from the next. You can think of element names as first names and XML namespaces as Sir names. (Its not a prefect analogy but it's illustrative).
Sometimes it's helpful to think of XML Namespaces as being similar to Java package names. When you create an XML Schema you are defining a type, just as a Java source file defines a type. The targetNamespace is the unique namespace of that type, just like the package name of a class defintion is the unique namespace of that type. In other words, declaring a targetNamespace in an XML Schema is the same as declaring a package name in a Java class file. It assigns the type(s) to a particular namespace.
The concept of a default namespace and a targetNamespace are orthogonal; they are separate concepts.
The default namespace has scope. If you create an XML document (be it an instance document, WSDL file, SOAP message or XML Schema) all of the elements are assumed to have unique namespaces. Usually, you will assign a prefix (a nick name) to each namespace and than tag elements that belong to that namespace with the prefix (e.g. <soap:Envelope> . However, it is possible to create a default namespace, which is the same as saying any elements without a prefix belong to a certain namespace. A default namespace is simply a namespace that is declared without a preface (e.g. xmlns="http://www.blue.com"). Default namespaces apply to the element in which they are declared and all of its children that do not use an explicit prefix.
You can override a default namespace by assigning a child element a different default namespace (e.g. xmlns="http:\\www.red.com") - that element and its children that do not have an explicit prefix will become part of the new default namespace.
I hope that helps. Tried to give you a couple different ways of thinking of things.