Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Name Spaces Questions

 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi;
I have some conflicts in my mind about NameSpaces
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>
2)Does <middlename> belongd to any namespace.
<prefix1:name xmlns refix1="www.google.com">
<firstname xmlns refix1="">
<middlename></middlename>
</firstname>
</prefix1:name>
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>
4)Does <firstname> belongs to any namesapce.
<prefix1:name xmlns"www.google.com">
<firstname>
</firstname>
</prefix1:name>

Thanks
 
Hung Tang
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Hung Tang
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, apologized of accusing you with typos, looks like I can't get mine right either.
Sorry!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic