[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Please clarify meaning of use="..." for attributes

  • From: "Tolkin, Steve" <Steve.Tolkin@F...>
  • To: xml-dev@l...
  • Date: Thu, 02 Nov 2000 14:26:54 -0500

clarify meaning
Below is an an excerpt from the latest XMLScheme.xsd, available from
www.w3c.org/2000/10/XMLSchema.xsd showing the "use" attribute that applies
to attributes.
It can take on 5 possible values: prohibited, optional, required, default,
and fixed.
When is it useful to say "prohibited"?  What exactly does fixed mean?  
I think I understand the other three values.

# answer attribute must be provided
<attribute name="answer" use="required"/> 

# answer attribute can be provided, but if not infoset will have answer="42"
<attribute name="answer" use="default" value="42"/> 

# answer attribute can be provided
<attribute name="answer" use="optional"/> 

Which of the next two comments is correct?
# answer attribute cannot be provided, and infoset has answer="42"
# answer attribute can be omitted, producing 42; or if provided must have
value 42.
<attribute name="answer" use="fixed" value="42"/>

And when would I ever want to say prohibited? Why would't I just omit the
attribute?
# answser attribute cannot be provided
<attribute name="answer" use="prohibited"/>


 <complexType name="attribute">
  <complexContent>
   <extension base="annotated">
    <sequence>
     <element name="simpleType" minOccurs="0" type="localSimpleType"/>
    </sequence>
    <attributeGroup ref="defRef"/>
    <attribute name="type" type="QName"/>
    <attribute name="use" use="default" value="optional">
     <simpleType>
      <restriction base="NMTOKEN">
       <enumeration value="prohibited"/>
       <enumeration value="optional"/>
       <enumeration value="required"/>
       <enumeration value="default"/>
       <enumeration value="fixed"/>
      </restriction>
     </simpleType>
    </attribute>
    <attribute name="value" use="optional" type="string"/>
    <attribute name="form" type="formChoice"/>
   </extension>
  </complexContent>
 </complexType>

Thanks,
Steve
-- 
Steven Tolkin          steve.tolkin@f...      617-563-0516 
Fidelity Investments   82 Devonshire St. V10D    Boston MA 02109
There is nothing so practical as a good theory.  Comments are by me, 
not Fidelity Investments, its subsidiaries or affiliates.

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.