This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 6158 - Allow attributes to precede elements
Summary: Allow attributes to precede elements
Status: RESOLVED LATER
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords: decided
Depends on:
Blocks:
 
Reported: 2008-10-13 16:13 UTC by Axel Dahmen
Modified: 2009-01-05 16:53 UTC (History)
1 user (show)

See Also:


Attachments

Description Axel Dahmen 2008-10-13 16:13:49 UTC
Hi,

currently attributes must follow sequence, choice, all and group constructs.

This way, creating XML Schema files having a certain degree of hierarchy level tears pretty much apart a type's definition by separating attributes far away from the header part:

  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>

              <xs:element name="nextLevel">
                <xs:complexType>
                  <xs:sequence>

                  ...
                  ...
                  ...

                  </xs:sequence>

                  <attribute name="name1" type="xs:string"/>
                  <attribute name="name2" type="xs:string"/>
                  <attribute name="name3" type="xs:string"/>
                </xs:complexType>
              </xs:element>

      </xs:sequence>
      <attribute name="name1" type="xs:string"/>
      <attribute name="name2" type="xs:string"/>
      <attribute name="name3" type="xs:string"/>
    </xs:complexType>
  </xs:element>


I'd very much like to suggest to allow attributes to precede an elements child definition, like this:

  <xs:element name="root">
    <xs:complexType>
      <attribute name="name1" type="xs:string"/>
      <attribute name="name2" type="xs:string"/>
      <attribute name="name3" type="xs:string"/>
      <xs:sequence>

              <xs:element name="nextLevel">
                <xs:complexType>
                  <xs:sequence>

                  ...
                  ...
                  ...

                  </xs:sequence>

                  <attribute name="name1" type="xs:string"/>
                  <attribute name="name2" type="xs:string"/>
                  <attribute name="name3" type="xs:string"/>
                </xs:complexType>
              </xs:element>

      </xs:sequence>
    </xs:complexType>
  </xs:element>

This way it's even more intuitive to read and perhaps more simple to parse.

www.axeldahmen.de
Axel Dahmen
Comment 1 C. M. Sperberg-McQueen 2008-10-29 18:08:35 UTC
The WG discussed this 17 October 2008.

A more formal and complete explication of this issue will be sent in due course; for now, I'm marking this decided.
Comment 2 David Ezell 2009-01-05 16:52:40 UTC
On 2009-01-05 DE responded to Axel Dahmen.  The actual email is at http://lists.w3.org/Archives/Member/w3c-xml-schema-wg/2009Jan/0003.html.

The text follows:

Dear Mr. Dahmen:

Thanks very much for your careful reading of our specification, and for your suggestion about 

changing the way we handle the defining and declaring of attributes within complex type definitions.

On October 17, 2009, the WG discussed the issue.  The relevant points from the discussion were:

- some WG members are very sympathetic with improving the syntax to make it more intuitive, or at least less counter intuitive.

- relaxing the spec to allow attributes to appear at the beginning of complex types would break backward compatibility.

- changing the spec to allow attributes to appear anywhere in the complex type definition is controversial with some WG members, since "unordered" does not mean "no order" - it often means the order may vary, but the actual document order is significant in each document instance.  For this case, document order would not be significant.

- changing the complexType declaration is may be overtaken by a more compact syntax.

Putting these points into a meaninful sentence:  while some WG members are sympathetic, the actual implementation as described would be controversial, and in any case may be overtaken with the "compact syntax" discussions that the WG plans to have after the publication of XML Schema 1.1.

So the WG would like to mark this issue as LATER.  Please let us know if you accept our resolution.

Thanks again for your comments.

Best regards,
David Ezell, chair
XML Schema WG
On behalf of the XML Schema WG