OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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@hotmail.com - 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