Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: "Overriding" Attribute Declarations

From: ht@---.--.--.-- (----- -. --------)
To: "Eliot Kimber" <ekimber@---------------.--->
Date: 6/12/2007 11:10:00 AM
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eliot Kimber writes:

> In XML DTDs, one can override the declaration of an attribute declared
> in an external declaration set by declaring the overriding version
> earlier, . . .

> I don't see an obvious way to do with with XSD using redefine.

Depends on the types of the attribute involved.  If the new type is a
restriction of the old, then this is straightforward:

baseAR.xsd:

<xs:schema>
 <xs:complexType name="b">
  <xs:attribute name="a" type="xs:string"/>
 </xs:complexType>
</xs:schema>

1AR.xsd:

<xs:schema>
 <xs:redefine schemaLocation="baseAR.xsd">  
 <xs:complexType name="b">
  <xs:complexContent>
   <xs:restriction base="b">
    <xs:attribute name="a" type="xs:token"/>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>
 </xs:redefine>
</xs:schema>

If the new type is _not_ a restriction of the old type, _and_ it's
optional in the base, you can cheat.  This is against the spirit of
the REC, but in practice allowed (I believe):

First we get rid of the attribute:

2AR.xsd:

<xs:schema>
 <xs:redefine schemaLocation="baseAR.xsd">
 <xs:complexType name="b">
  <xs:complexContent>
   <xs:restriction base="b">
    <xs:attribute name="a" use="prohibited"/>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>
 </xs:redefine>
</xs:schema>

Then we add it back with the desired type:

3AR.xsd:

<xs:schema>
 <xs:redefine schemaLocation="2AR.xsd">
 <xs:complexType name="b">
  <xs:complexContent>
   <xs:extension base="b">
    <xs:attribute name="a" type="xs:integer"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 </xs:redefine>
</xs:schema>

If this helps, hold your nose and go for it!

ht
=2D -- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@i...
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged sp=
am]
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFGbmLtkjnJixAXWBoRAhgDAJ42zqyJXnxDDd563PERQF+OzuLYWwCdFHef
oObEhzbTgejT4ykMLo+a2fs=
=BG5E
=2D----END PGP SIGNATURE-----

From dan@m... Tue Jun 12 09:29:47 2007
Received: from maggie.w3.org ([193.51.208.68])
	by frink.w3.org with esmtp (Exim 4.50)
	


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