[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Character classification

  • From: James Clark <jjc@j...>
  • To: xml-dev@i...
  • Date: Fri, 05 Sep 1997 12:04:43 +0700

three level page table
Istvan Cseri wrote:
> 
> For better speed I would suggest an alternative solution: use a quick
> array lookup for characters below 256 and go to the more expensive
> method above... It will do wonders with your parser.

Except of course when you're parsing non-Latin scripts.

There's another technique which exploits the fact that characters on the
same page often have similar properties, and this is true even more so
for characters in the same column.

The idea is to have a three-level table, the first level with 256
entries, the second and third levels with 16 entries.  The entries for
the first and second levels are a (possibly null) pointer to a sub-table
plus a value; the entries for the third level are just values. To look
up the value for a character, you use the high 8 bits to index into the
first-level table; if the pointer part of the entry is null, then return
the value part of entry; otherwise use the sub-table table addressed by
the pointer; use the next 4 bits to index into that in a similar way,
and, if necessary, the bottom 4 bits to index into the bottom table.

This is I believe quite a well-known technique; I got it from Glenn
Adams.

You can use this to implement case-folding by storing the difference
between a character and its upper-case equivalent modulo 2^16.

There's a C++ implementation of this in SP in include/CharMap.h.

James


xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo@i... the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.