Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Qualified attributes and attribute references in schemas

From: Adam van den Hoven <avandenhoven@-----.--->
To: XML Schema Development <xmlschema-dev@--.--->
Date: 7/21/2004 7:20:00 AM
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"
targetNamespace="http://schema.foo.net/bar"
  attributeFormDefault="unqualified" xmlns:b="http://schema.foo.net/bar">
  <xs:attribute name="foo" type="xs:string"/>
  <xs:element name="element">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="b:element"/>
      </xs:choice>
      <xs:attribute ref="b:foo"/>
      <xs:attribute name="bar" type="xs:string"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

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>
</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"/>
</b:element>

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?

Adam

From nobody@w...  Wed Jul 21 17:20:56 2004
Return-Path: <nobody


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent