Re: [xml-dev] Adding an attribute to an enumerated list

From
Pete Cordell <>
To
Allison Bloodworth <>,
Date
2005-07-13T18:21:14Z
ID
<001d01c587d7$ac3303b0$b700a8c0@RW>
Thread
Re: [xml-dev] Adding an attribute to an enumerated list
Hi Allison,

I'm not quite sure exactly what you mean by "I'd like people to be able to 
redefine certain types into enumerated lists", but possibly what you need to 
do is define a simpleType with your enumerations as you suggest.  Then add 
the attribute by extending the simpleType into complexType, simpleContent.

Something like:

  <xs:simpleType name="MySimpleEnumeratedType">
   <xs:restriction base="xs:string">
    <xs:enumeration value="???"/>
    <xs:enumeration value="???"/>
    <xs:enumeration value="???"/>
   </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="MyEnumerationWithAttribute">
   <xs:simpleContent>
    <xs:extension base="MySimpleEnumeratedType">
     <xs:attribute name="MyAttribute" type="???????"/>
    </xs:extension>
   </xs:simpleContent>
  </xs:complexType>

Pete.

P.S.  Thanks to all those that answered my questions earlier today.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
                         for XML to C++ data binding visit
                         http://www.tech-know-ware.com/lmx
                         (or http://www.xml2cpp.com)
=============================================

----- Original Message ----- 
From: "Allison Bloodworth" <>
> Hi,
>
>
>
> I have searched the XML-dev archives as well as the UBL 1.0 specification
> and CodeList Representation paper and can't find a good solution to my
> problem, so I thought I'd ask for any suggestions out there.
>
> I am trying to create a very flexible schema for a public Event for which
> I'd like people to be able to redefine certain types into enumerated lists
> when they use the schema. It seems that this means the types must be
> simpleTypes, since only simpleTypes can be restricted into enumerations.
> However, I'd also like these types to have an attribute that will allow 
> the
> user of the schema to indicate what language the content of the element
> (which will eventually use the type) is in. It seems that this is
> impossible, as simpleTypes cannot have attributes. UBL 1.0 seems to have a
> way of attaching this meta-data to an enumerated list/codelist (involving
> the creation of both a simpleType to hold the enumeration values, and a
> complexType to hold "supplementary components"-the metadata about the
> codelist), but it seems too complicated for my purposes as I really only
> have one attribute I want to use.
>
>
>
> Doesn't anyone else out there ever want to create an enumerated list that
> has an attribute attached to it? Am I missing something simple or is this 
> a
> difficult problem?
>
>
>
> Allison Bloodworth
>
> Principal Administrative Analyst
>
> e-Berkeley Program Office
>
> University of California, Berkeley
>
> (415) 377-8243
>
> 
>
>
>
>