- From: <noah_mendelsohn@us.ibm.com>
- Date: Tue, 4 Dec 2001 11:38:32 -0500
- To: Jeni Tennison <jeni@jenitennison.com>
- Cc: Naomi@cs.cornell.edu, xmlschema-dev@w3.org
Right. There would be all sorts of strange problems that could arise if types/element/attribute declarations could change in an uncontrolled manner during a validation. It would at best add complexity. Locally scoped elements provide a limited capability in that direction, but otherwise schema is based on an organizing principle that the definitions and declarations used in a validation are conceptually invariant (you can pick them up as you go, but there must be no visible side effects of such incremental processing.) Among other things, this rule ensures that systems like compilers will yield results consistent with, e.g. streaming implementations. ------------------------------------------------------------------------ Noah Mendelsohn Voice: 1-617-693-4036 Lotus Development Corp. Fax: 1-617-693-8676 One Rogers Street Cambridge, MA 02142 ------------------------------------------------------------------------ Jeni Tennison <jeni@jenitennison.com> Sent by: xmlschema-dev-request@w3.org 12/03/01 05:44 AM Please respond to Jeni Tennison To: "Naomi Dushay" <Naomi@cs.cornell.edu> cc: xmlschema-dev@w3.org, (bcc: Noah Mendelsohn/CAM/Lotus) Subject: Re: scoping of namespace prefix Hi Naomi, > I'm running into a problem with prefix scoping. > > My instance document (simplified): > > <bar:A xmlns:bar="ignored" xmlns:foo="http://foo.namespace" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="ignored bar.xsd"> > <foo:B xsi:schemaLocation="http://foo.namespace fooB.xsd"> > <foo:Q /> > <foo:R /> > </foo:B> > <foo:C xsi:schemaLocation="http://foo.namespace fooC.xsd"> > <foo:Y /> > <foo:Z /> > </foo:C> > </bar:A> > > I have XML schemas bar.xsd, fooB.xsd and fooC.xsd, all of which are > valid. I can't find anything in the XML Schema spec that implies the > above instance doc shouldn't work. But there seems to be a namespace > prefix collision for prefix "foo." This is true for XSV and for the > topologi Schematron Validator. The problem is that you can't change the association between a namespace and a schema half way through a document. On any single assessment, a schema validator will only consider one schema for a particular namespace. The xsi:schemaLocation (or xsi:noNamespaceSchemaLocation) attribute that defines the association between a namespace and a schema has to be on or before the first element in the document with that namespace, but then has a scope beyond (after) that element as well. This is described in http://www.w3.org/TR/xmlschema-1/#schema-loc. Effectively this means that you may as well define all your associations between namespaces and schemas on the document element. If you have different schemas for different sections of the document, I'd recommend that you use different namespaces for those different sections. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Tuesday, 4 December 2001 11:50:29 UTC