• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Doubt in Schema

 
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<schema xmlns="http://www.w3.org/2001/XMLSchema"

xmlns:mh="http://www.Monson-Haefel.com/jwsbook"
targetNamespace="http://www.Monson-Haefel.com/jwsbook">


I have understood the url specified in the xmlns and also the url specified in the targetNamespace,but i am not able to understand the
attribute xmlns:mh.

Can any body explain me what does it mean???


Thanks

Anil Kumar
[ March 14, 2008: Message edited by: anil kumar ]
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by anil kumar:
I have understood the url specified in the xmlns and also the url specified in the targetNamespace



Technically speaking they are URIs, not (necessarily) URLs - they identify something - they do not have to be a valid address.


i am not able to understand the attribute xmlns:mh



It isn't an attribute - it's a namespace declaration

xmlns:mh="http://www.Monson-Haefel.com/jwsbook"

means:

"I will refer to the {http://www.Monson-Haefel.com/jwsbook} namespace and will henceforth use the prefix 'mh' to refer to it"


targetNamespace declares the namespace into which you define your new elements, types and attributes - kind of like the Java "package" statement. Unlike Java's "package" though targetNamespace doesn't make that namespace the default namespace. If you want to use any of the elements, types and attributes that you have just defined (even to simply refer to them in the definition of other new elements, types, and attributes) you have to establish a way to refer to them by either making your targetNamespace the default namespace

xmlns="http://www.Monson-Haefel.com/jwsbook"

or assigning a prefix to it

xmlns:mh="http://www.Monson-Haefel.com/jwsbook"

See also namespace and targetnamespace
Confusion in namespace

Ronald Bourret's XML Namespaces FAQ
James Clark: XML Namespaces
 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Peer i have understood,but i have one more doubt.

xmlns:mh="http://www.Monson-Haefel.com/jwsbook"

in the above why do we have to use xmlns:mh??
can't we say mh="http://www.Monson-Haefel.com/jwsbook" ???


Please clarify this.

Thanks

Anil Kumar
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

in the above why do we have to use xmlns:mh?? can't we say mh="http://www.Monson-Haefel.com/jwsbook" ???



A namespace declaration always starts with "xmlns". That is the rule - end of story.
See 4.1) How do I declare an XML namespace in an XML document?

"xmlns=..." declares the default namespace; "xmlns:mh=..." declares a namespace that will be referenced inside the scope with the "mh" prefix.
 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peer

Thank you ,I have got it




Thanks & Regards

Anil Kumar
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic