[XML-SIG] Character classes
Sat, 12 Jan 2002 14:33:08 +0100
Martin v. Loewis wrote:
>>The Unicode 3.0 database is mostly backward compatible w/r to Unicode 2.0;
>>except for a few well documented changes. I don't think we should care
> For strict XML conformance, one may want to worry; see
The XML spec doesn't mention a specific Unicode
version. Unicode 3 is mentioned in the spec as well:
OTOH, Letter is defined explicitly without reference to the
> Also, it isn't easy to construct the XML character
> classes with just the Python Unicode properties. For example, Python's
> .isalpha() mostly matches XML's BaseChar class, except for the Roman
> numerals, and the ESTIMATED SYMBOL, which got recategorized in 3.0.
> For NameChar, the Python Unicode support does not offer anything
> close. The regular expressions \w is a strict superset, but contains
> many characters that match \w but are not NameChars (e.g. SUPERSET TWO).
In that case, I suppose you ought to simply create a database
similar to that used by unicodectype.c which uses the explicit
character ranges defined in the XML spec as reference and
provides API for querying isLetter(), isBaseChar() etc.
Tools/unicode/makeunicodedata.py has the needed tools to
generate such a table, so this shouldn't be too complicated.
CEO eGenix.com Software GmbH
Company & Consulting: http://www.egenix.com/
Python Software: http://www.egenix.com/files/python/