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

Is this schema legal?

From: Dave Kuhlman <dkuhlman@rexx.com>
Date: Fri, 15 Jan 2010 15:45:42 -0800 (PST)
Message-ID: <203698.34419.qm@web82508.mail.mud.yahoo.com>
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:element name="recipe">
            <xs:element name="flour" type="flourType" />
            <xs:element name="spice">
                  <xs:element name="spice">
                      <xs:restriction base="xs:string">
                        <xs:length value="10"/>

      <xs:complexType name="flourType">
          <xs:element name="style" type= "xs:string" />
          <xs:element name="grade" type= "xs:integer" />

# ============================================

- Dave


Dave Kuhlman
Received on Friday, 15 January 2010 23:46:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:17 UTC