Thank you very much!

Eric



|---------+---------------------------->
|         |           [EMAIL PROTECTED] |
|         |                            |
|         |           02/11/2003 11:00 |
|         |           AM               |
|         |           Please respond to|
|         |           xerces-j-user    |
|         |                            |
|---------+---------------------------->
  
>-----------------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                          |
  |       To:       [EMAIL PROTECTED]                                           
                               |
  |       cc:                                                                   
                                          |
  |       Subject:  Re: unable to redefine attributeGroups                      
                                          |
  
>-----------------------------------------------------------------------------------------------------------------------|




Hi Eric,

Your syntax was close, but not quite right.  The trick is that, instead of
repeating the content of the attributeGroup you're redefining, you have to
explicitly reference it; here's a redone b.xsd that exemplifies this (and
that Xerces is happy to validate).  (See attached file: b.xsd)

Hope that helps!
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:  905-413-3519, T/L 969-3519
E-mail:  [EMAIL PROTECTED]




|---------+-------------------------------->
|         |           [EMAIL PROTECTED]|
|         |           asswell.com          |
|         |                                |
|         |           02/10/2003 07:50 PM  |
|         |           Please respond to    |
|         |           xerces-j-user        |
|         |                                |
|---------+-------------------------------->
  >
  
---------------------------------------------------------------------------------------------------------------------------------------------|

  |
  |
  |       To:       [EMAIL PROTECTED]
  |
  |       cc:
  |
  |       Subject:  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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



(See attached file: b.xsd)
---------------------------------------------------------------------
 To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Attachment: b.xsd
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to