I'm new to xsd and learning about namespaces. Seen maximum all questions, blog etc but no one could help me understand in simple way.
What I have understood so far is that, Namespaces are used to differentiate elements having same names. (Not cleared about targetnamespace)
My understanding to make namespace is below
xlmns:foo()="URI" -->Namespace (Its a unique token I would say which is responsible to differentiate elements with this syntax. And this synatx given a name and the criteria of making that name is Prefix:ElementName-->Prefix.
I have got one example
<foo:tag xmlns:foo="http://me.com/namespaces/foofoo"
xmlns:bar="http://me.com/namespaces/foobar"
>
<foo:head>
<foo:title>An example document</foo:title>
</foo:head>
<bar:body>
<bar:e1>a simple document</bar:e1>
<bar:e2>
Another element
</bar:e2>
</bar:body>
</foo:tag>
If we want to use multiple namespaces in a xsd then we can declare them once like in above example. Where same prefix is being used for multiple namespaces
foo:tag --->xmlns:foo="http://me.com/namespaces/foofoo"
foo:tag --->xmlns:bar="http://me.com/namespaces/foobar
Is it same like in java where in a package we can have multiple classes and each class has its own attributes, in case of xml its elements. Am I correct ? Can anyone help me to understand TargetNamespace ?