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

RE: Newbie question: fixed attribute & restriction

  • From: Priscilla Walmsley <priscilla@w...>
  • To: 'Guy Crets' <guycrets@h...>, xml-dev@l...
  • Date: Fri, 10 Aug 2001 11:08:23 -0400

xsd restriction
Hi Guy,

You can't add new attributes in a restriction.  What you want is an
extension.

The only time you would use attributes in a restriction would be to restrict
attributes that are already declared for the base type. (e.g., to restrict
the attribute's type, to make an optional attribute required, etc.)  This
would only apply if the base type was a complex type, though.


Priscilla Walmsley
Vitria Technology

> -----Original Message-----
> From: Guy Crets [mailto:guycrets@h...]
> Sent: Friday, August 10, 2001 10:27 AM
> To: xml-dev@l...
> Subject: Newbie question: fixed attribute & restriction
>
>
> Hi All,
>
> Is it allowed to have an attribute within a restriction?  If I
> read/understand the Schema 2001 spec well, it is.
>
> However, Xerces 1.4.2 reports an error when parsing (validating) the
> document underneath.  "Error: URI=null Line=5: Schema error:
> Anonymous
> complexType: ct-props-correct.2: The type 'xsd:string' is a
> simple type.  It
> cannot be used in a derivation by RESTRICTION for a
> complexType."  When
> using extension instead of restriction, all goes well.
>
> Thanks for your feedback.  Regards, Guy Crets (Belgium)
>
> xsd/ODS-ME-RA02-3.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- test xsd - guycrets@h... - Guy Crets 08-aug-2001 -->
> <xsd:schema targetNamespace="http://www.test.com/ODS-ME-RA02-3"
>                       xmlns="http://www.test.com/ODS-ME-RA02-3"
>                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                   elementFormDefault="qualified"
>                   version="8-aug-2001">
>
> <xsd:element name="RA02_StatementOfAccountMessage">
>   <xsd:complexType>
>     <xsd:sequence>
>       <xsd:element ref="C022_InformationFromFunloc" minOccurs="1"
> maxOccurs="1"/>
>     </xsd:sequence>
>   </xsd:complexType>
> </xsd:element>
>
> <xsd:element name="C022_InformationFromFunloc">
> <xsd:complexType>
>   <xsd:simpleContent>
>    <xsd:restriction base="xsd:string">
>     <xsd:attribute name="type" type="xsd:string" fixed="DE"/>
>    </xsd:restriction>
>   </xsd:simpleContent>
> </xsd:complexType>
> </xsd:element>
>
> </xsd:schema>
>
> RA02t3.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <RA02_StatementOfAccountMessage
>                xmlns="http://www.test.com/ODS-ME-RA02-3"
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.test.com/ODS-ME-RA02-3
> xsd/ODS-ME-RA02-3.xsd">
> <C022_InformationFromFunloc>134446</C022_InformationFromFunloc>
> </RA02_StatementOfAccountMessage>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com/intl.asp
>
>
> ------------------------------------------------------------------
> The xml-dev list is sponsored by XML.org
> <http://www.xml.org>, an initiative of OASIS
> <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To unsubscribe from this elist send a message with the single word
> "unsubscribe" in the body to: xml-dev-request@l...
>


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.