Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Problem with types derived from mixed complex types

From: Tait E Larson <telarson@--.---.--->
To: "Michael Kay" <mhk@---.--.-->
Date: 6/4/2004 5:42:00 AM




Michael,

I'm not 100% sure your example works in this case.  In the case described
in the link below the base type is complex (i.e. contains other elements).
In your example I believe "xsl:generic-element-type" is simple.

I tried modifiying your example slightly.  Here's a new example.

      <xs:complexType name="SUB">
            <xs:simpleContent>
                  <xs:restriction base="BASE">
                        <xs:simpleType>
                              <restriction base="xs:string"/>
                        </xs:simpleType>
                        <xs:attribute name="attrB" type="xs:string"
fixed="foo" />
                  </xs:restriction>
            </xs:simpleContent>
      </xs:complexType>

      <xs:complexType name="BASE" mixed="true">
            <xs:sequence>
                  <xs:element name="elemA" type="xs:integer" />
            </xs:sequence>
            <xs:attribute name="attrB" type="xs:string" />
      </xs:complexType>


I get the following error when I try to validate this schema or the schema
you provided:


src-ct.2: Complex Type Definition Representation Error for type 'SUB'.
When simpleContent is used, the base type must be a complexType whose
content type is simple, or, only if extension is      specified, a simple
type.

I'm using WebSphere Studio Application Developer v5.1.1 (based on eclipse)
for validation.

Thanks for your help.

Tait



                                                                           
             "Michael Kay"                                                 
             <mhk@m...>                                               
                                                                        To 
             06/04/2004 09:58          Tait E Larson/Burlingame/IBM@IBMUS, 
             AM                        <xmlschema-dev@w...>              
                                                                        cc 
                                                                           
                                                                   Subject 
                                       RE: Problem with types derived from 
                                       mixed complex types                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




This is how it's done in the schema for XSLT 2.0:

<xs:complexType name="versioned-element-type" mixed="true">
  <xs:complexContent>
    <xs:extension base="xsl:generic-element-type">
      <xs:attribute name="version" type="xs:decimal" use="optional"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="text-element-base-type">
  <xs:simpleContent>
    <xs:restriction base="xsl:versioned-element-type">
      <xs:simpleType>
        <xs:restriction base="xs:string"/>
      </xs:simpleType>
      <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:restriction>
  </xs:simpleContent>
</xs:complexType>

<xs:element name="text" substitutionGroup="xsl:instruction">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xsl:text-element-base-type">
        <xs:attribute name="disable-output-escaping" type="xsl:yes-or-no"
default="no"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>

This is doing what the post you refer to says isn't allowed: deriving
simpleContent by restriction from complexContent. It seems to work!

Michael Kay


>
>
> In regards to restricting a complex type so that it only
> contains text, has
> this problem been resolved?  The original post can be found here:
>
> http://lists.w3.org/Archives/Public/xmlschema-dev/2003Jan/0028.html
>
> I looked through the errata at:
>
> http://www.w3.org/2001/05/xmlschema-rec-comments.html.
>
> I could not find any discussion of the problem.
>
> Thanks,
>
> Tait
>
>
>




From nobody@w...  Fri Jun  4 18:18:36 2004
Return-Path: <nobody@w...>
X-Original-To: xmlschema-dev+aa@l...
Delivered-To: xmlschema-dev+a


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent