Skip to main content



      Home
Home » Archived » XML Schema Definition (XSD) » maxLength not permitted in string
maxLength not permitted in string [message #588044] Thu, 03 June 2004 09:37
Eclipse UserFriend
Originally posted by: jerome.negre+news.fr.adp.com

Hi,

I've got a strange behavior when I have a group containing an element
whose type is a restricition of a simpleType defined in an included
schema. If the simpleType is defined in the same schema, or if I replace
the group by a complexType, everything's ok.

The error message I got is: The maxLength facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'.

Here's a simple test case:

--8<--- Main schema: myschema.xsd --------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<schema
targetNamespace="http://eu.adp.com"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:this="http://eu.adp.com">

<include schemaLocation="util.xsd"/>

<simpleType name="internalType">
<restriction base="string">
<pattern value="[A-Z]*"/>
</restriction>
</simpleType>

<group name="MyGroup">
<sequence>
<!-- OK -->
<element name="myInternalElement" nillable="true">
<simpleType>
<restriction base="this:internalType">
<maxLength value="5"/>
</restriction>
</simpleType>
</element>
<!-- DOES NOT WORK -->
<element name="myExternalElement" nillable="true">
<simpleType>
<restriction base="this:externalType">
<maxLength value="5"/>
</restriction>
</simpleType>
</element>
</sequence>
</group>

<complexType name="MyComplexType">
<sequence>
<!-- OK -->
<element name="myInternalElement" nillable="true">
<simpleType>
<restriction base="this:internalType">
<maxLength value="5"/>
</restriction>
</simpleType>
</element>
<!-- OK -->
<element name="myExternalElement" nillable="true">
<simpleType>
<restriction base="this:externalType">
<maxLength value="5"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>

</schema>
--8<--- End of myschema.xsd --------------------------------------

--8<--- Included schema: util.xsd --------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<schema
targetNamespace="http://eu.adp.com"
xmlns="http://www.w3.org/2001/XMLSchema">

<simpleType name="externalType">
<restriction base="string">
<pattern value="[A-Z]*"/>
</restriction>
</simpleType>

</schema>
--8<--- End of util.xsd ------------------------------------------

I have this result both with XSD 1.1.1.1 and I20040308.

Does anyone have a clue on what I might be doing wrong, or should I open a
bug in Bugzilla?

Thanks in advance,
Jérôme
Previous Topic:Inherited attributes
Next Topic:XSDConstrainingFacet.getEffectiveValue().toString()
Goto Forum:
  


Current Time: Fri Jul 04 16:45:25 EDT 2025

Powered by FUDForum. Page generated in 0.02917 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top