Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] StackOverflowError compiling XOM

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Michael Kay" <mike AT saxonica.com>
  • To: <elharo AT metalab.unc.edu>, <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] StackOverflowError compiling XOM
  • Date: Fri, 11 Jul 2008 10:00:36 +0100

> I'll have to take a look at what you did some time.

Three examples:

Classes like Big5CharacterSet have a one-bit property per character which is
encoded like this:

private static long[] flags = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0x3500c100L, 0x10000000100L,
0x0L, 0x0L, 0x0L, 0x0L,
0x0L, 0x0L, 0x0L, 0x170004000000000L,
0x0L, 0x0L, 0x7fffdfc07fffL, 0xdfc0000000000000L,
0x40000ff81fffffffL, 0xffff400000000000L, 0x0L, 0x0L,
0x0L, 0x0L, 0x0L, 0x0L,

UnicodeData.java represents integer properties of characters using an array
of strings holding comma-separated base-32 numbers, which gets parsed out on
first usage:

public static final String[] compatibilityList = {
"50,58,5a,5f,5i,5j,5k,5l,5o,5p,5q,5s,5t,5u,9i,9j,9v,a0,a9,",
"bv,e4,e5,e6,e7,e8,e9,ea,eb,ec,fh,fi,fj,lg,lh,li,lj,lk,ll,lm,",
"ln,lo,mo,mp,mq,mr,ms,mt,n0,n1,n2,n3,n4,rq,s4,ug,uh,ui,ul,um,",
"vg,vh,vi,vk,vl,vp,1c7,1jl,1jm,1jn,1jo,3hj,3lj,3ms,3mt,3oc,3rn,3rp,47s,79c,"
,
"79d,79e,79g,79h,79i,79j,79k,79l,79m,79n,79o,79p,79q,79s,79t,79u,79v,7a0,7a1
,7a2,",
"7a3,7a4,7a5,7a6,7a7,7a8,7a9,7aa,7ab,7ac,7ad,7af,7ag,7ah,7ai,7aj,7ak,7al,7am
,7an,",

ISO88597CharacterSet.java populates a static boolean array in a static
initializer:

static {
c = new boolean[1000];
Arrays.fill(c, 0, 161, true);
c[26] = false;
c[163] = true;
Arrays.fill(c, 166, 180, true);
c[170] = false;
c[174] = false;
c[175] = false;
c[183] = true;
c[187] = true;
c[189] = true;

All these of course are generated code (sometimes hand-tweaked afterwards),
and the thing I possibly haven't got right is that regenerating it if the
data ever changes would require some serious archaeology.

Michael Kay
http://www.saxonica.com/





Archive powered by MHonArc 2.6.24.

Top of Page