W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2001

Can the schema change the namespace in the instance?

From: Robert Braddock <stormwarden@bigfoot.com>
Date: Wed, 3 Jan 2001 23:17:52 -0600
To: xmlschema-dev@w3.org
Message-ID: <20010103231752.G29280@concordant-thought.com>
I've poked at this a bit and not come up with an answer: I can't seem to
specify a namespace to be included from a separate schema so it can be used
in my instance document without explicit namespace commands. That is, I
expect to be able to do something like this:

     <schema targetNamespace='ns-A' xmlns:nsb='ns-B'>
     <element name='doc'>
       <complexType>
         <sequence>
           <element ref='nsb:other-stuff'/>
         </sequence>
       </complexType>
     </element>
     </schema>

     <schema targetNamespace='ns-B'>
       <element name='other-stuff'>
         <complexType>
           <sequence>
             <any namespace='ns-B' minOccurs='0' maxOccurs='unbounded'/>
           </sequence>
         <attribute name='xmlns' use='fixed' 
                    value='ns-B'/>
         </complexType>
       </element>
     </schema>
     

and have my instance doc look like this:

     <doc xmlns='ns-A'>
     <other-stuff><para>use ns-B tags here, like para</para></other-stuff>
     <doc>

but when I try it with XSV it complains about all the other-stuff content
being undefined in ns-A. It works if I put the xmlns='ns-B' declarations in
the instance doc explicitly. I'm trying to use schemas without having to
incur too much cruft, like explicitly qualifying everything and having to
have a bunch of redundant namespace declarations. Surely this is not an
unusual expectation, right? 

It just occurred to me that the "xmlns" attribute might itself need a
specific namespace--is that the problem? 

(Oh, and are there any instructions for getting XSV running locally on unix?
 I've gotten it to validate, but I had to change a file to the "forceDTD"
 branch to get it to work, and I don't see anything that says what that
 means or whether other files need to be branched and updated too.)


Thanks,
Robert Braddock
Received on Thursday, 4 January 2001 00:18:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:19 GMT