W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2004

Qualified attributes and attribute references in schemas

From: Adam van den Hoven <avandenhoven@cucbc.com>
Date: Wed, 21 Jul 2004 14:20:05 -0700
To: XML Schema Development <xmlschema-dev@w3.org>
Message-ID: <BD242C15.79FA%avandenhoven@cucbc.com>

I have an odd situation with my IDE (oxygenXML) and I can't tell if its a
problem with my schema or the IDE (well the xml parser used by the IDE). As
an example, I have the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  attributeFormDefault="unqualified" xmlns:b="http://schema.foo.net/bar">
  <xs:attribute name="foo" type="xs:string"/>
  <xs:element name="element">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="b:element"/>
      <xs:attribute ref="b:foo"/>
      <xs:attribute name="bar" type="xs:string"/>

What I'm expecting is nested element tags each with optional foo and bar
attributes. I created the following document:

<?xml version="1.0" encoding="UTF-8"?>
<element xmlns="http://schema.foo.net/bar"
  <element foo="bar" bar="foo"></element>

When I validate this against the schema above, I get the following error:
    Attribute 'foo' is not allowed to appear in element 'element'.

If I do:
<b:element xmlns:b="http://schema.foo.net/bar">
  <b:element b:foo="bar" bar="foo"/>

All is forgiven and it passes validation.

As far as I can read in Eric Meyer's book the form should follow the default
set in the root xs:schema element.

So which is right?

Received on Wednesday, 21 July 2004 17:20:42 UTC

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