- public void startElement(XML.Element c) throws XML.SchemaException {
- if (templateNodeHasBeenFinished) {
- throw new XML.SchemaException("no elements may appear after the <template> node");
-
- } else if (!rootNodeHasBeenEncountered) {
- if (!"xwt".equals(c.localName)) throw new XML.SchemaException("root element was not <xwt>");
- if (c.len != 0) throw new XML.SchemaException("root element must not have attributes");
- rootNodeHasBeenEncountered = true;
- return;
-
- } else if (!templateNodeHasBeenEncountered) {
- if (nameOfHeaderNodeBeingProcessed != null) throw new XML.SchemaException("can't nest header nodes");
- nameOfHeaderNodeBeingProcessed = c.localName;
-
- if (c.localName.equals("import")) {
- if (c.len != 1 || !c.keys[0].equals("name"))
- throw new XML.SchemaException("<import> node must have exactly one attribute, which must be called 'name'");
- String importpackage = c.vals[0].toString();
- if (importpackage.endsWith(".*")) importpackage = importpackage.substring(0, importpackage.length() - 2);
- return;
-
- } else if (c.localName.equals("redirect")) {
- if (c.len != 1 || !c.keys[0].equals("target"))
- throw new XML.SchemaException("<redirect> node must have exactly one attribute, which must be called 'target'");
- if (t.redirect != null)
- throw new XML.SchemaException("the <redirect> header element may not appear more than once");
- t.redirect = c.vals[0].toString();
- if(t.redirect.equals("null")) t.redirect = null;
- return;
-
- } else if (c.localName.equals("preapply")) {
- if (c.len != 1 || !c.keys[0].equals("name"))
- throw new XML.SchemaException("<preapply> node must have exactly one attribute, which must be called 'name'");
- preapply.addElement(c.vals[0]);
- return;
-
- } else if (c.localName.equals("postapply")) {
- if (c.len != 1 || !c.keys[0].equals("name"))
- throw new XML.SchemaException("<postapply> node must have exactly one attribute, which must be called 'name'");
- postapply.addElement(c.vals[0]);
- return;
+ private JS parseScript(StringBuffer content, int content_start) throws IOException {
+ if (content == null) return null;
+ String contentString = content.toString();
+ if (contentString.trim().length() > 0) return JS.fromReader("FIXME", content_start, new StringReader(contentString));
+ return null;
+ }