• 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

NameSpaces in XML

 
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,

<foo:book xmlns:foo="http://www.books.com/books"
xmlns=""http://www.notes.com/books">
<book1>Name</book1>
<foo:book1>Name</foo:book1>
</foo:book>

Can anyone explain on this code?

the tags book1 and foo:book1 where it refers to?
and give me some explanation about the default namespaces and how it works?

thanx in advance!!
 
Bartender
Posts: 3904
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Krishna Srinivasan:
HI,

<foo:book xmlns:foo="http://www.books.com/books"
xmlns=""http://www.notes.com/books">
<book1>Name</book1>
<foo:book1>Name</foo:book1>
</foo:book>

Can anyone explain on this code?

the tags book1 and foo:book1 where it refers to?
and give me some explanation about the default namespaces and how it works?

thanx in advance!!



Hello Krishna !

This line :



declared 2 namespaces:

1. with prefix 'foo' - http://www.books.com/books
2. default, without any prefix - http://www.notes.com/books (I assume double quote is just a typo)

so, *within* the tag where namespaces were declared,
  • book1 - default namespace - belongs to 'http://www.notes.com/books'
  • foo:book1 - 'foo' namespace - belongs to 'http://www.books.com/books'


  • More on namespaces you can find here -
    http://java.boot.by/wsd-guide/ch01s03.html

    regards,
    MZ
     
    Krishna Srinivasan
    Ranch Hand
    Posts: 1880
    Firefox Browser Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you for your reply.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic