• 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

Against what schemas validate themselves?

 
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am trying to understand how schemas validate themselves.

I have the following schema: [myXMLSchemaTwo.xsd]


and the following xml document:[newXMLDocumentTwo.xml]



How does the parser/validator match the namespace (http://www.w3.org/2001/XMLSchema) to the schema of schemas? Is the schema of schemas held locally or is it fetched from the www?

Another (related) question is how does a xml instance document retrieve its schemalocation element from.

see here:



Thanks in advance,

Julien.
 
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 Julien Martin:
How does the parser/validator match the namespace (http://www.w3.org/2001/XMLSchema) to the schema of schemas? Is the schema of schemas held locally or is it fetched from the www?



As a rule (default), validation is an optional activity. The namespace declaration just provides an identifier (i.e. name) for that namespace � so it exists primarily to avoid naming collisions - nothing else. You usually have to configure the parser to do the validation. During validation the XML document is validated against the document's schema but the document's schema isn't validated. You can validate a schema against XMLSchema � in that case the schema is "the XML Document" being validated. However you will have to provide the parser with a location of the version of XMLSchema you wish validate against � that version can be local or over the network. An XML document can always provide the location of the schema that it is to be validated against � that's what "schemaLocation" is for. However that is only a suggestion. You can configure the parser to use a different copy (like one that is locally cached) and that one will be used instead of the one specified with "schemaLocation".
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Peer,
Thanks a lot for your answer. It is interesting what you say about the configuration of the parser. In my case, I use Netbeans in order to validate xml SCHEMAS and was just wondering where NB fetches the schema of schemas (or indeed whether it does this at all) in order to validate my schemas.
Julien.
 
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
For validation you need the location of a schema. It's important to remember that "http://www.w3.org/2001/XMLSchema" is simply the identifier of the namespace � it doesn't need to be a valid URL. Just having the identifier does not enable you to perform validation. See
Need explanations about urn and uri for a targetNamespace
Ronald Bourret's XML Namespaces FAQ
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic