1)To Which name spcace the <firstname> elsement belongs.
<prefix1:name xmlns refix1="www.google.com" xmlns refix2="www.yahoo.com">
<firstname>
</firstname>
</prefix1:name>
firstname element DOES NOT belong to ANY namespace
Had you inserted a default namespace, the firstname element will be take that
declared default namespace (i.e. xmlns="urn
efaultNamespace")
2)Does <middlename> belongd to any namespace.
<prefix1:name xmlns refix1="www.google.com">
<firstname xmlns refix1="">
<middlename></middlename>
</firstname>
</prefix1:name>
Maybe you missed a typo somewhere but it should be
<prefix1:name xmlns
refix1="www.google.com">
In this particular context, the <firstname xmlns
refix1=""> has no meaning.
Anyhow, you don't have a default namespace declared within that scope that middlename element belongs to, so middlename does not belong to ANY namespace.
3)Is Name Space Declaration is undeclared in follown code
<prefix1:name xmlns"www.google.com">
<firstname xmlns refix1=" ">
<!--See Space -->
<middlename></middlename>
</firstname>
</prefix1:name>
Assuming that you get your declaration right; that is <prefix1:name xmlns="www.google.com" xmlns
refix1="someOtherNameSpace">
Then yes, there is a namespace declared. In fact, two of them, one default, and one with a prefix of prefix1.
4)Does <firstname> belongs to any namesapce.
<prefix1:name xmlns"www.google.com">
<firstname>
</firstname>
</prefix1:name>
Sure, firstname belongs to
www.google.com namespace since you have declared a default namespace.
PS. attributes that do not have a prefix attached to it and are declared under an element with a declared default namespace DOES NOT have any namespace attached to it.
i.e. in the above example, if your
<firstname> was changed to <firstname ID="2">
then ID has no namespace attached to it.
Hope this helps