/** * @param page the page nodes from which to generate the XML view * @param compiler The compiler for this page * @throws JasperException If an error occurs */ public PageDataImpl(Node.Nodes page, Compiler compiler) throws JasperException { // First pass FirstPassVisitor firstPass = new FirstPassVisitor(page.getRoot(), compiler.getPageInfo()); page.visit(firstPass); // Second pass buf = new StringBuilder(); SecondPassVisitor secondPass = new SecondPassVisitor(page.getRoot(), buf, compiler, firstPass.getJspIdPrefix()); page.visit(secondPass); }
/* * Appends the given tag, including its body, to the XML view, * and optionally reset default namespace to "", if none specified. */ private void appendTag(Node n, boolean addDefaultNS) throws JasperException { Node.Nodes body = n.getBody(); String text = n.getText(); buf.append("<").append(n.getQName()); buf.append("\n"); printAttributes(n, addDefaultNS); buf.append(" ").append(jspIdPrefix).append(":id").append("=\""); buf.append(jspId++).append("\"\n"); if (ROOT_ACTION.equals(n.getLocalName()) || body != null || text != null) { buf.append(">\n"); if (ROOT_ACTION.equals(n.getLocalName())) { if (compiler.getCompilationContext().isTagFile()) { appendTagDirective(); } else { appendPageDirective(); } } if (body != null) { body.visit(this); } else { appendText(text, false); } buf.append("</" + n.getQName() + ">\n"); } else { buf.append("/>\n"); } }
public void apply(Node.Nodes page, ErrorDispatcher err, PageInfo pageInfo) throws JasperException { init(err); if (tagPlugins == null || tagPlugins.size() == 0) { return; } this.pageInfo = pageInfo; page.visit( new Node.Visitor() { public void visit(Node.CustomTag n) throws JasperException { invokePlugin(n); visitBody(n); } }); }
public static void set(Node.Nodes page, ErrorDispatcher err) throws JasperException { page.visit(new CustomTagCounter()); page.visit(new ScriptingVariableVisitor(err)); }