• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

namespace and targetnamespace

 
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone explain the difference between these 2? Or perhaps refer me to some document/book that explains this clearly.
Thanks


Jeff Mutonho

SCJP
 
Bartender
Posts: 2968
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
targetNamespace is used in XML Schemas and WSDL to identify and select the namespace into which new elements that your are defining are created in. Once you have defined a new element you still need a namespace declaration to be able to reference the new element or type.

Example:

The targetNamespace is "http://www.Monson-Haefel.com/jwsbook".
Types created:
  • {http://www.Monson-Haefel.com/jwsbook}USAddress
  • {http://www.Monson-Haefel.com/jwsbook}Book
  • {http://www.Monson-Haefel.com/jwsbook}PurchaseOrder


  • Elements created:
  • {http://www.Monson-Haefel.com/jwsbook}purchaseOrder
  • {http://www.Monson-Haefel.com/jwsbook}address


  • Note however that there is also a namespace declaration xmlns:mh="http://www.Monson-Haefel.com/jwsbook". So when you reference anything that exists in the "http://www.Monson-Haefel.com/jwsbook" namespace you simply use the prefix "mh" within the scope of that element (in this case schema). This is used in the PurchaseOrder type definition where {http://www.Monson-Haefel.com/jwsbook}USAddress is referenced as mh:USAddress and {http://www.Monson-Haefel.com/jwsbook}Book is referenced as mh:Book.

    Ronald Bourret's XML Namespaces FAQ
    James Clark: XML Namespaces
     
    jeff mutonho
    Ranch Hand
    Posts: 271
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks.That really helped
     
    Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
    Gift giving made easy with the permaculture playing cards
    https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    reply
      Bookmark Topic Watch Topic
    • New Topic