Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Constraining a mixed type ?

From: "Bruno Chatel" <bcha@-------.--->
To: <xmlschema-dev@--.--->
Date: 4/16/2004 11:11:00 AM
Hi,

I wonder if it is possible to define a constrain on a mixed content using
XML Schemas. 
For example, I need to specify that there is at least one character in my mixed
complextype. 

I try the following schema :

<xs:simpleType name="nonempty-content-ST">
    <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
    </xs:restriction>
</xs:simpleType>

<xs:complexType name="nonempty-content-CT">
    <xs:simpleContent>
        <xs:extension base="nonempty-content-ST"/>
    </xs:simpleContent>
</xs:complexType>

<xs:complexType name="mixed-content-CT" mixed="true">
    <xs:complexContent mixed="true">
        <xs:extension base="nonempty-content-CT">
            <xs:choice maxOccurs="unbounded">
                    <xs:element name="emph" type="xs:string"/>
            </xs:choice>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

<xs:element name="p" type="mixed-content-CT"/>

But it have problem to validate a document such 

<p><emph>test</emph></p>

is this schema correct ?

It there an other  way to write this ?

Thanks in advance

-- bruno -- 
Bruno Chatel
Tel : (+33) (0)4 96 11 14 57
bcha@c...
--------------------------------------

From gaytri_v@y...  Fri Apr 16 03:11:02 2004
Return-Path: <gaytri_v@yahoo


transparent
Print
Mail
Like It
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