From: adam Date: Thu, 23 Sep 2004 08:32:17 +0000 (+0000) Subject: import X-Git-Url: http://git.megacz.com/?p=org.ibex.xt.git;a=commitdiff_plain;h=308cdcc279f012c0b69b871f81ec1c11c703bd13 import darcs-hash:20040923083217-5007d-cacf91c75a5198038c2644983de979f738e59b6f.gz --- 308cdcc279f012c0b69b871f81ec1c11c703bd13 diff --git a/src/org/ibex/xml/JSRewriter.java b/src/org/ibex/xml/JSRewriter.java new file mode 100644 index 0000000..d87afb3 --- /dev/null +++ b/src/org/ibex/xml/JSRewriter.java @@ -0,0 +1,48 @@ +package org.ibex.xml; +import org.ibex.js.*; +import org.ibex.util.*; +import org.ibex.io.*; +import java.io.*; +import java.net.*; +import java.util.*; + +public class JSRewriter extends XML.Node.Stream { + + private XML.Node.Stream in; + private JSScope scope; + + public JSRewriter(XML.Node.Stream in) { this.in = in; this.scope = new JSScope(null); } + public JSRewriter(XML.Node.Stream in, JSScope scope) { this.in = in; this.scope = scope; } + + public boolean _next(int level, XML.Node n) { + if (!in.next(level, n)) return false; + if (n.cdata != null) n.cdata = eval(n.cdata); + else for(int i=1; i