Page 1 of 1

ASCII characters

Posted: Sat Jan 15, 2005 3:03 am
by Guest
Hi,
I have a string(6-240 characters) for which I need to check that each of the characters is a valid ASCII character. Any ideas?

Thank You,

Ilan

Posted: Mon Jan 17, 2005 8:22 pm
by george
Hi,

You can have something like:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="test" type="test"/>
<xs:simpleType name="test">
<xs:restriction base="xs:string">
<xs:pattern value="(\p{IsBasicLatin})*"/>
<xs:maxLength value="240"/>
<xs:minLength value="6"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
This will accept between 6 and 240 ASCII characters as the content of the test element.

Hope that helps,
George