Page 1 of 1

ASCII characters

Posted: Sat Jan 15, 2005 3:03 am
by Guest
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,


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

You can have something like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="">
<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"/>
This will accept between 6 and 240 ASCII characters as the content of the test element.

Hope that helps,