This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Where are namespaces defined?  RSS feed

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a fairly good understanding of how namespaces work when used in an XML document, what I don't understand is where the URI comes from or how my IDE for example knows what elements are associated with that namespace. For example, in a JSF file you can refer to the core JSF namespace by using the following, and that the alias "f" could be pretty much anything I would like, but the URI must be "http://java.sun.com/jsf/core" otherwise my IDE doesn't know what those elements are and when the JSF is being processed will cause it to fail.



So obviously, the URI is important and it must be stored somewhere, but where?

I understand that the URI is not a URL, it doesn't necessarily point to a resource as it is not a Universal Resource Locator but instead a Universal Resource Identifier. My question is where is the URI actually defined and where are the elements that make up the namespace defined?
 
Sheriff
Posts: 23640
48
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Don Blodgett wrote:

So obviously, the URI is important and it must be stored somewhere, but where?



Yes, it's important. It doesn't follow that it must be stored somewhere.

A similar case: when you're writing Java code the "public" keyword is important when you're declaring a method. But where is it stored? Well, it isn't stored anywhere. Software which needs to know its meaning (i.e. Java compilers) is written to follow a specification which describes it. I suppose you could say that the "public" keyword is "stored in" the Java Language Specification but most speakers of English wouldn't say that.

Likewise the URI in a namespace declaration is "stored in" a specification which describes how elements and atttributes in that namespace should be handled. In the example you gave, somewhere there is a JSF specification which describes that.
 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:Yes, it's important. It doesn't follow that it must be stored somewhere.



I agree with what you are saying, "stored" is not really the correct word here, but it certainly is defined in a specification which is stored somewhere. I guess my question is not really where this specification for JSF is, but generally where would an XML namespace be defined? Is it a DTD or XSD? If so how do those define the namespace they are defining? Or is it more complex than that? For example, with JSF I am assuming that it has to do with tag libs which I would imagine are all contained in the JAR files for the different JSF libraries. Am I on the right track here?
 
Paul Clapham
Sheriff
Posts: 23640
48
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an example. The namespace URI for XSLT is http://www.w3.org/1999/XSL/Transform. That's defined in this document: XSL Transformations (XSLT) Version 1.0. You'll notice that in section 2.1 of the document, the namespace URI is specified.
 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:Here's an example. The namespace URI for XSLT is http://www.w3.org/1999/XSL/Transform. That's defined in this document: XSL Transformations (XSLT) Version 1.0. You'll notice that in section 2.1 of the document, the namespace URI is specified.



Thank you, that clears up a lot. Basically it is up to the implementation to determine how it is going to verify that the namespace is followed according to the specification.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!