void recurse(TemplateNodeModel node, TemplateSequenceModel namespaces) throws TemplateException, IOException { if (node == null) { node = this.getCurrentVisitorNode(); if (node == null) { throw new _TemplateModelException( "The target node of recursion is missing or null."); } } TemplateSequenceModel children = node.getChildNodes(); if (children == null) { return; } int size = children.size(); for (int i = 0; i < size; i++) { TemplateNodeModel child = (TemplateNodeModel) children.get(i); if (child != null) { invokeNodeHandlerFor(child, namespaces); } } }
@Override TemplateElement[] accept(Environment env) throws IOException, TemplateException { TemplateModel node = targetNode.eval(env); if (!(node instanceof TemplateNodeModel)) { throw new NonNodeException(targetNode, node, env); } TemplateModel nss = namespaces == null ? null : namespaces.eval(env); if (namespaces instanceof StringLiteral) { nss = env.importLib(((TemplateScalarModel) nss).getAsString(), null); } else if (namespaces instanceof ListLiteral) { nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env); } if (nss != null) { if (nss instanceof Environment.Namespace) { SimpleSequence ss = new SimpleSequence(1); ss.add(nss); nss = ss; } else if (!(nss instanceof TemplateSequenceModel)) { if (namespaces != null) { throw new NonSequenceException(namespaces, nss, env); } else { // Should not occur throw new _MiscTemplateException(env, "Expecting a sequence of namespaces after \"using\""); } } } env.invokeNodeHandlerFor((TemplateNodeModel) node, (TemplateSequenceModel) nss); return null; }
void recurse(TemplateNodeModel node, TemplateSequenceModel namespaces) throws TemplateException, IOException { if (node == null) { node = this.getCurrentVisitorNode(); if (node == null) { throw new _TemplateModelException( "The target node of recursion is missing or null."); } } TemplateSequenceModel children = node.getChildNodes(); if (children == null) { return; } int size = children.size(); for (int i = 0; i < size; i++) { TemplateNodeModel child = (TemplateNodeModel) children.get(i); if (child != null) { invokeNodeHandlerFor(child, namespaces); } } }
void recurse(TemplateNodeModel node, TemplateSequenceModel namespaces) throws TemplateException, IOException { if (node == null) { node = this.getCurrentVisitorNode(); if (node == null) { throw new _TemplateModelException( "The target node of recursion is missing or null."); } } TemplateSequenceModel children = node.getChildNodes(); if (children == null) { return; } int size = children.size(); for (int i = 0; i < size; i++) { TemplateNodeModel child = (TemplateNodeModel) children.get(i); if (child != null) { invokeNodeHandlerFor(child, namespaces); } } }
@Override TemplateElement[] accept(Environment env) throws IOException, TemplateException { TemplateModel node = targetNode.eval(env); if (!(node instanceof TemplateNodeModel)) { throw new NonNodeException(targetNode, node, env); } TemplateModel nss = namespaces == null ? null : namespaces.eval(env); if (namespaces instanceof StringLiteral) { nss = env.importLib(((TemplateScalarModel) nss).getAsString(), null); } else if (namespaces instanceof ListLiteral) { nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env); } if (nss != null) { if (nss instanceof Environment.Namespace) { SimpleSequence ss = new SimpleSequence(1); ss.add(nss); nss = ss; } else if (!(nss instanceof TemplateSequenceModel)) { if (namespaces != null) { throw new NonSequenceException(namespaces, nss, env); } else { // Should not occur throw new _MiscTemplateException(env, "Expecting a sequence of namespaces after \"using\""); } } } env.invokeNodeHandlerFor((TemplateNodeModel) node, (TemplateSequenceModel) nss); return null; }
@Override TemplateElement[] accept(Environment env) throws IOException, TemplateException { TemplateModel node = targetNode.eval(env); if (!(node instanceof TemplateNodeModel)) { throw new NonNodeException(targetNode, node, env); } TemplateModel nss = namespaces == null ? null : namespaces.eval(env); if (namespaces instanceof StringLiteral) { nss = env.importLib(((TemplateScalarModel) nss).getAsString(), null); } else if (namespaces instanceof ListLiteral) { nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env); } if (nss != null) { if (nss instanceof Environment.Namespace) { SimpleSequence ss = new SimpleSequence(1); ss.add(nss); nss = ss; } else if (!(nss instanceof TemplateSequenceModel)) { if (namespaces != null) { throw new NonSequenceException(namespaces, nss, env); } else { // Should not occur throw new _MiscTemplateException(env, "Expecting a sequence of namespaces after \"using\""); } } } env.invokeNodeHandlerFor((TemplateNodeModel) node, (TemplateSequenceModel) nss); return null; }