-
- } else if (!templateNodeHasBeenEncountered) {
- if (nameOfHeaderNodeBeingProcessed != null) throw new XML.SAXException("can't nest header nodes");
- nameOfHeaderNodeBeingProcessed = name;
-
- if (name.equals("import")) {
- if (keys.length != 1 || !keys[0].equals("name"))
- throw new XML.SAXException("<import> node must have exactly one attribute, which must be called 'name'");
- String importpackage = vals[0].toString();
- if (importpackage.endsWith(".*")) importpackage = importpackage.substring(0, importpackage.length() - 2);
- importlist.addElement(importpackage);
- return;
-
- } else if (name.equals("redirect")) {
- if (keys.length != 1 || !keys[0].equals("target"))
- throw new XML.SAXException("<redirect> node must have exactly one attribute, which must be called 'target'");
- if (t.redirect != null)
- throw new XML.SAXException("the <redirect> header element may not appear more than once");
- t.redirect = vals[0].toString();
- return;
-
- } else if (name.equals("preapply")) {
- if (keys.length != 1 || !keys[0].equals("name"))
- throw new XML.SAXException("<preapply> node must have exactly one attribute, which must be called 'name'");
- preapply.addElement(vals[0]);
- return;
-
- } else if (name.equals("postapply")) {
- if (keys.length != 1 || !keys[0].equals("name"))
- throw new XML.SAXException("<postapply> node must have exactly one attribute, which must be called 'name'");
- postapply.addElement(vals[0]);
- return;
-
- } else if (name.equals("static")) {
- if (staticNodeHasBeenEncountered)
- throw new XML.SAXException("the <static> header node may not appear more than once");
- if (keys.length > 0)
- throw new XML.SAXException("the <static> node may not have attributes");
- staticNodeHasBeenEncountered = true;
- return;
-
- } else if (name.equals("preserve")) {
- if (keys.length != 1 || !keys[0].equals("attributes"))
- throw new XML.SAXException("<preserve> node must have exactly one attribute, which must be called 'attributes'");
- if (t.preserve != null)
- throw new XML.SAXException("<preserve> header element may not appear more than once");
-
- StringTokenizer tok = new StringTokenizer(vals[0].toString(), ",", false);
- t.preserve = new String[tok.countTokens()];
- for(int i=0; i<t.preserve.length; i++) t.preserve[i] = tok.nextToken();
- return;
-
- } else if (name.equals("template")) {
- // finalize importlist/preapply/postapply, since they can't change from here on
- importlist.toArray(t.importlist = new String[importlist.size()]);
- if (preapply.size() > 0) preapply.copyInto(t.preapply = new String[preapply.size()]);
- if (postapply.size() > 0) postapply.copyInto(t.postapply = new String[postapply.size()]);
- importlist = preapply = postapply = null;
- templateNodeHasBeenEncountered = true;