Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: multiple namespaces

From: noah_mendelsohn@--.---.---
To: "Andrew Welch" <andrew.j.welch@-----.--->
Date: 4/23/2007 6:36:00 AM
Andrew Welch writes:

> With this XML:
> 
>   <ns1:foo>some text</ns1:foo>
>   <ns2:bar>some text</ns2:bar>

Well, first of all, that's not an XML document you could validate, so 
let's assume you meant something along the lines of:

With this XML:

  <ns1:root xmlns:ns1="uri1" xmlns:ns1="uri2">
    <ns1:foo>some text</ns1:foo>
    <ns2:bar>some text</ns2:bar>
  </ns1:root>


> Am I right in thinking I need two schemas - one for each namespace?

Well, you're terminology isn't quite what the Recommendation uses, but in 
the sense you probably mean the answer is "yes", at least presuming you 
wanted to actually validate the contents of both elements, rather than 
just accepting them with a wildcard.  To be a bit more precise, to 
validate the element information item "root" you would need a single 
>schema< with components declaring (at least) the three elements ns1:root, 
ns1:foo, and ns2:bar.

What you're (almost surely) thinking of as a schema is what the 
Recommendation calls a >Schema Document<, I.e. an XML document with a root 
of <xs:schema>.  Since each of those can contribute declarations for at 
most one so-called target namespace, in this case ns1 or ns2, you will 
need two such documents.  Very probably the schema document for ns1 will 
import the one for ns2, though there are other ways to get both documents 
used.  For example, some processors would let you name both schema 
documents on a command line or in an api. 

Anyway, the careful answer your question is:  you will be using one 
schema, which will almost surely be built (composed) from at least two 
schema documents.  The informal answer to your question is:  yes.  :-)

Noah

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------





From andrew.j.welch@g... Mon Apr 23 15:05:54 2007
Received: from maggie.w3.org ([193.51.208.68]


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent