You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Er...@Classwell.com on 2003/02/11 01:50:54 UTC

unable to redefine attributeGroups

Xerces (2.3.0) doesn't seem to allow me to redefine attributeGroups. It
throws a 'derivation-ok-restriction.2.2' error.
Now maybe there's some flaw in my syntax (damned if I can find an example
of  using redefine on an attributeGroup anywhere on the entire WWW!), but
the spec seems to allow it. Here's a minimal example:

Schema "a.xsd"

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault
="qualified" attributeFormDefault="unqualified">
  <xs:element name="root">
     <xs:annotation>
       <xs:documentation>Comment describing your root
element</xs:documentation>
     </xs:annotation>
     <xs:complexType>
       <xs:attributeGroup ref="ab"/>
     </xs:complexType>
  </xs:element>
  <xs:attributeGroup name="ab">
     <xs:attribute name="a"/>
     <xs:attribute name="b"/>
  </xs:attributeGroup>
</xs:schema>

Schema "b.xsd"

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault
="qualified" attributeFormDefault="unqualified">
  <xs:redefine schemaLocation="a.xsd">
     <xs:attributeGroup name="ab">
       <xs:attribute name="a"/>
       <xs:attribute name="b"/>
       <xs:attribute name="c"/>
       <xs:attribute name="d"/>
     </xs:attributeGroup>
  </xs:redefine>
  <xs:element name="rut">
     <xs:annotation>
       <xs:documentation>Comment describing your root
element</xs:documentation>
     </xs:annotation>
     <xs:complexType>
       <xs:attributeGroup ref="ab"/>
     </xs:complexType>
  </xs:element>
</xs:schema>

An xml instance "c.xml"

<?xml version="1.0" encoding="UTF-8"?>
<rut xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="b.xsd" a="Text" b="Text" c="text" d="text"/>

I get, when attempting to validate this with xerces (either DOM or SAX),
the following error:

[Error] b.xsd:5:28: src-redefine.7.2.2: attributeGroup 'ab' does not
properly restrict the attributeGroup it redefines; constraint violated:
'derivation-ok-restriction.2.2'.

I don't believe restriction (or extension) of attributeGroups is legal in
xsd. However I beleive redefinition is. Is there something silly I'm doing
or erroneous about my understanding here, or is this a bug?

I'm using Xerces 2.3.0.

Thanks,

Eric Schwarzenbach





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org