- From: Dave Kuhlman <dkuhlman@rexx.com>
- Date: Fri, 15 Jan 2010 15:45:42 -0800 (PST)
- To: xmlschema-dev@w3.org
I think this is a schema question, but it also might be an XML namespaces question. The schema below has two definitions for the tag "spice", one nested inside the other. Is that allowed? I would have thought that you can have only one definition for a name within a given namespace. But, is it possible that it's OK in this case because one is in a nested scope? And, could someone point me at something that answers this question. I tried searching the XML Schema specs at w3.org, but could not find anything definite. The closest thing I could find was the following: A {scope} of global identifies element declarations available for use in content models throughout the schema. Locally scoped declarations are available for use only within the complex type identified by the {scope} property. This property is *absent* in the case of declarations within named model groups: their scope is determined when they are used in the construction of complex type definitions. (http://www.w3.org/TR/xmlschema-1/#cElement_Declarations) But, it's really saying something about *scope*, not about whether whether a name must be unique within a namespace. And, I'm asking this question because I need to know whether generateDS.py (a tool that that I work on and that generates Python bindings/classes from an XML schema) should handle this situation. Any guidance will be appreciated. Here's the schema: # ============================================ <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" > <xs:element name="recipe"> <xs:complexType> <xs:sequence> <xs:element name="flour" type="flourType" /> <xs:element name="spice"> <xs:complexType> <xs:sequence> <xs:element name="spice"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:length value="10"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="flourType"> <xs:sequence> <xs:element name="style" type= "xs:string" /> <xs:element name="grade" type= "xs:integer" /> </xs:sequence> </xs:complexType> </xs:schema> # ============================================ - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman
Received on Friday, 15 January 2010 23:46:16 UTC