Redefining an enumerated attribute type

Discussion in 'XML' started by Nick Bassiliades, Dec 9, 2005.

  1. Hi everybody,

    I would like to ask a very specific question about how I can re-define
    an enumerated attribute type.
    Specifically, I have two XML Schema files.

    In file A I have the following attribute group declaration:

    *********** file A ******************
    <xs:attributeGroup name="kind.attrib">
    <xs:attribute name="kind" use="optional" default="fo">
    <xs:simpleType>
    <xs:restriction base="xs:NMTOKEN">
    <xs:enumeration value="fo"/>
    <xs:enumeration value="lp"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    </xs:attributeGroup>
    *************************************

    I file B I want to re-define this attribute in order to include
    more constants as possible values for the @kind attribute.
    The following produces an error, because the new definition
    is not a restriction of the definition found in file A:

    ***************** file B *********************
    <xs:redefine schemaLocation="...file A">
    <xs:attributeGroup name="kind.attrib">
    <xs:attribute name="kind" use="required" default="dr">
    <xs:simpleType>
    <xs:restriction base="xs:NMTOKEN">
    <xs:enumeration value="fo"/>
    <xs:enumeration value="lp"/>
    <xs:enumeration value="sr"/>
    <xs:enumeration value="dr"/>
    <xs:enumeration value="df"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    </xs:attributeGroup>
    ....
    *************************************


    Notice, that I cannot just change the definition in file A because I
    simply do not own it.
    How could this be done? How could I extend in a redefinition and not
    restrict it?

    I have also tried with union but I get the same message (union is an
    extension, not a restriction).

    Thank you in advance,

    Nick Bassiliades
    Nick Bassiliades, Dec 9, 2005
    #1
    1. Advertising

  2. Nick Bassiliades writes:


    > I file B I want to re-define this attribute in order to include
    > more constants as possible values for [an enumeration].


    > Notice, that I cannot just change the definition in file A because I
    > simply do not own it.
    > How could this be done? How could I extend in a redefinition and not
    > restrict it?


    The short answer is 'no'.

    The slightly longer answer is that there are good ways to design an
    extendable enumeration type, but that requires a change to the
    original definition, which you say you can't do.

    ht
    --
    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:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
    Henry S. Thompson, Dec 12, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marek Ponca

    Enumerated Type in assertion ?

    Marek Ponca, Jan 10, 2005, in forum: VHDL
    Replies:
    2
    Views:
    3,209
    Jonathan Bromley
    Jan 10, 2005
  2. Alastair Cameron
    Replies:
    1
    Views:
    1,574
    Colin Mackenzie
    Jul 4, 2003
  3. Replies:
    1
    Views:
    367
    Henry S. Thompson
    Mar 6, 2006
  4. David
    Replies:
    0
    Views:
    362
    David
    Mar 1, 2006
  5. Andrew FPGA
    Replies:
    1
    Views:
    685
    amakyonin
    Jun 26, 2006
Loading...

Share This Page