- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Fri, 9 Nov 2001 09:57:08 +0000
- To: Saul Farber <saul@syncline.com>
- CC: xmlschema-dev@w3.org
Hi Saul, > However, I don't think I understand the rationale behind the > solution...I mean, the wsdl-schema document was aware of the > http://www.w3.org/2001/XMLSchema namespace (heck, the WSDL-schema > document uses it as the default namespace...it's a SCHEMA document!) > Why couldn't it just apply whatever method it was using to validate > all the other schemas to the instance document as well? Here's a > clearer formulation of my question: It "knows" about the XML Schema namespace on a different level than it "knows" about the validation of your XML document. When a schema validator comes across an element that it's been told it must validate, then it looks at the schema's element declarations to try to find an element declaration that matches that element. A schema's element declarations can come from the schema itself, from included schemas or from imported schemas. There's nothing in the XML Schema Rec that gives the XML Schema namespace any special significance in terms of always including the element declarations from the XML Schema namespace in the schema. It would be a bit burdensome if it did - for every schema, a schema validator would have to include all the definitions of the elements and complex types from the XML Schema namespace. So you have to tell the schema validator that the set of element declarations from the XML Schema namespace should be included in the set of element declarations for the schema itself. That's what the xs:import element does in the schema, or adding entries to the xsi:schemaLocation attribute does in the instance. However, because, as you say, schema validators *do* know about XML Schema, you might be able to use an xs:import element that doesn't explicitly point to a schema for the XML Schema namespace, using: <xs:import namespace="http://www.w3.org/2001/XMLSchema" /> (Or actually Priscilla's suggestion was better because that means you don't have to add every possible xs:import to the schema - if you knew what namespace the ##other elements were coming from, in order to import all of them then you'd presumably list them in the xs:any in the first place.) > Now the validation-logic of my parser (Xerces-1.4.3) doesn't seem to > have any problem validating the WSDL schema, and I didn't explicitly > resolve the schema-uri there! Yet if I write schema like the above I > will always get that error. I need to explicitly resolve the > "http://www.w3.org/2001/XMLSchema" ns if I want to get proper > validation, (either in the WSDL-schema document with an <xs:import> > element or in the instance document with an xsi:schemaLocation > attribute). > > Is this "parser-funkiness" or is this the intention of the spec? It's the intention of the spec. When you have a wildcard like: <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" /> You are saying any element from any namespace other than the target namespace is allowed at this point. When you validate that schema, how is the schema validator supposed to know that the specific namespace that you're actually going to use is the XML Schema namespace rather than the HTML namespace or the MathML namespace or the SVG namespace or the XSLT namespace? It can't tell which namespace an element is going to come from, so it can't tell whether it's going to have the element declarations to match elements in that namespace. And in any case, it might not have to do anything at all, since there might not be an element from another namespace there at all (since the minOccurs is 0). I hope that kinda explains it. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Friday, 9 November 2001 04:57:10 UTC