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

Newbie question: fixed attribute & restriction

  • From: Guy Crets <guycrets@h...>
  • To: xml-dev@l...
  • Date: Fri, 10 Aug 2001 16:26:45 +0200

xsd fixed
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


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.