The moose likes Web Services Certification (SCDJWS/OCPJWSD) and the fly likes NameSpaces in XML Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Services Certification (SCDJWS/OCPJWSD)
Reply Bookmark "NameSpaces in XML" Watch "NameSpaces in XML" New topic
Author

NameSpaces in XML

Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1790
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!!


Krishna Srinivasan
Java Writers Needed
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 2989
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


    Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
    Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz [in progress...]
    Krishna Srinivasan
    Ranch Hand

    Joined: Jul 28, 2003
    Posts: 1790
    Thank you for your reply.
     
     
    subject: NameSpaces in XML
     
    Threads others viewed
    returning user defined objects
    XML Scripting is not working
    How to use the bean Object
    Is my approach right while inserting a foreign key?
    StaleStateException
    developer file tools