[Home] [By Thread] [By Date] [Recent Entries]


Prasad G S K <prasadg@a...> writes:

> Can I redefine 'enumeration' element in the XSD I write?
>  
> I want the 'enumeration' element defined at http://www.w3.org/2001/XMLSchema
> <http://www.w3.org/2001/XMLSchema>  namespace to hold some other custom
> element i.e.,
> I should be able to write as follows in my instance document.
>  
> <simpleType name="MyType">
> <restriction base="string">
>     <enumeration value="ABC">
>         <MyElement  value="xxx"/>
>     </enumeraion>
> </restriction>
> </simpleType>

No.  The type definitions of most of the elements and attributes in
the W3C XML Schema namespace are defined with blockDefault='#all', meaning
that you cannot use anything other than the expected types for those
elements.

However there is a place where you are allowed to put your extensions,
namely the appInfo element:

<simpleType name="MyType" xmlns:my="http://www.example.org/Prasad/Extension">
 <restriction base="string">
     <enumeration value="ABC">
         <annotation>
          <appInfo>
           <my:Element value="xxx"/>
          </appInfo>
         </annotation>
     </enumeraion>
 </restriction>
 </simpleType>


-- 
  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@c...
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member