- // FIXME: height must come after image
- // FIXME: thisbox must come first
- t.keys[i] = (String)v.elementAt(i);
- t.vals[i] = h.get(t.keys[i]);
+ if (c.keys[i] == null) throw new RuntimeException("XML parser returned a null key position="+i);
+ if (c.keys[i].equals("font") && c.uris[i] != null) c.vals[i] = c.uris[i] + "." + c.vals[i];
+ if (c.keys[i].equals("preapply")) {
+ // process preapply and 'remove' from array
+ String uri = c.uris[i] == null ? "" : c.uris[i] + '.';
+ StringTokenizer tok = new StringTokenizer(c.vals[i].toString(), " ");
+ while(tok.hasMoreTokens()) t.preapply.addElement(uri + tok.nextToken());
+
+ if (i < c.len - 1) { // not the last attribute
+ c.keys[i] = c.keys[c.len - 1];
+ c.vals[i] = c.vals[c.len - 1];
+ c.uris[i] = c.uris[c.len - 1];
+ }
+ c.len--; i--;
+ continue;
+ }
+ h.put(c.keys[i], c.vals[i]);
+ }
+ t.keys = new String[h.size()];
+ t.vals = new Object[h.size()];
+
+ Vec v = new Vec(h.size(), c.keys);
+ v.sort(new Vec.CompareFunc() { public int compare(Object a, Object b) { return ((String)a).compareTo((String)b); } });
+ for(int i=0; i<h.size(); i++) {
+ if (c.keys[i].equals("thisbox")) {
+ for(int j=i; j>0; j--) { t.keys[j] = t.keys[j - 1]; t.vals[j] = t.vals[j - 1]; }
+ t.keys[0] = (String)v.elementAt(i);
+ t.vals[0] = h.get(t.keys[0]);
+ } else {
+ t.keys[i] = (String)v.elementAt(i);
+ t.vals[i] = h.get(t.keys[i]);
+ }