Hi Sean,
Try declare your type "four_type" this way:
<simpleType name="four_type">
<restriction base="string">
<whiteSpace value="collapse"/>
<maxLength value="4"/>
</restriction>
</simpleType>
Then the parser will normalize your string by removing any leading and
trailing spaces.
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-416) 448-3255
[EMAIL PROTECTED]
"McEligot, Sean
(contractor)" To: "Xerces-J User Mailing List
(E-mail)"
<[EMAIL PROTECTED] <[EMAIL PROTECTED]>
.ARMY.MIL> cc:
Subject: whitespace and schema
string length
04/17/2001
02:37 PM
Please respond
to
xerces-j-user
I was expecting schema string maxLength validations to ignore white space,
but that doesn't appear to be the case. Is this a bug, or can this behavior
be toggled, or am I just wrong in my expectations? To illustrate, in the
following example I get this message:
length.xml:5:25:5:26 Datatype error: In element 'four' : Value ' 1234 '
with
length '6' exceeds maximum length facet of '
4'..
<!------------ length.xml ------------>
<?xml version="1.0" encoding="UTF-8"?>
<personnel xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='length.xsd'>
<person>
<four> 1234 </four>
</person>
</personnel>
<!------------ length.xsd ------------>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns='http://www.w3.org/2000/10/XMLSchema'>
<element name="personnel">
<complexType>
<sequence>
<element ref="person" minOccurs='1' maxOccurs='unbounded'/>
</sequence>
</complexType>
</element>
<element name="person">
<complexType>
<sequence>
<element name="four" type="four_type" minOccurs='0' maxOccurs='1'/>
</sequence>
</complexType>
</element>
<simpleType name="four_type">
<restriction base="string">
<maxLength value="4" />
</restriction>
</simpleType>
</schema>
Thanks,
Sean
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]