• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Name Spaces Questions

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops, apologized of accusing you with typos, looks like I can't get mine right either.
Sorry!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic