public void writeElementEnd(Element element, Writer writer) throws IOException { writeElementEnd(element, writer, null); }
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException { writeElementStart(element, writer); }
private String extractTextContent(Node node, ExecutionContext executionContext) { if(node.getNodeType() == Node.TEXT_NODE) { return node.getTextContent(); } else if(node.getNodeType() == Node.ELEMENT_NODE && ContextObjectSerializationUnit.isContextObjectElement((Element) node)) { String contextKey = ContextObjectSerializationUnit.getContextKey((Element) node); return (String) executionContext.getAttribute(contextKey); } else if(node.getNodeType() == Node.ELEMENT_NODE && TextSerializationUnit.isTextElement((Element) node)) { return TextSerializationUnit.getText((Element) node); } else { throw new SmooksException("Unsupported 'bindTo' or toOutStream templating action. The bind data must be attached to a DOM Text node, or already bound to a <context-object> element."); } }
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException { String key = getContextKey(element); if(key != null) { Object object = executionContext.getAttribute(key); if(object != null) { writer.write(object.toString()); } else { logger.debug("Invalid <context-object> specification at '" + DomUtils.getXPath(element) + "'. No Object instance found on context at '" + key + "'."); } } else { logger.warn("Invalid <context-object> specification at '" + DomUtils.getXPath(element) + "'. 'key' attribute not specified."); } }
public void writeElementStart(Element element, Writer writer) throws IOException { writer.write((int)'<'); writer.write(element.getTagName()); writeAttributes(element.getAttributes(), writer); if(closeEmptyElements && !element.hasChildNodes()) { // Do nothing. We'll close it "short-hand" in writeElementEnd below... } else { writer.write((int)'>'); } }
@Override protected void visit(Element element, ExecutionContext executionContext) { // First thing we do is clone the template for this transformation... StringTemplate thisTransTemplate = template.getInstanceOf(); Map<String, Object> beans = executionContext.getBeanContext().getBeanMap(); String templatingResult; Node resultNode; // Set the document data beans on the template and apply it... thisTransTemplate.setAttributes(beans); templatingResult = thisTransTemplate.toString(); resultNode = TextSerializationUnit.createTextElement(element, templatingResult); // Process the templating action, supplying the templating result... processTemplateAction(element, resultNode, executionContext); }
private String extractTextContent(Node node, ExecutionContext executionContext) { if(node.getNodeType() == Node.TEXT_NODE) { return node.getTextContent(); } else if(node.getNodeType() == Node.ELEMENT_NODE && ContextObjectSerializationUnit.isContextObjectElement((Element) node)) { String contextKey = ContextObjectSerializationUnit.getContextKey((Element) node); return (String) executionContext.getAttribute(contextKey); } else if(node.getNodeType() == Node.ELEMENT_NODE && TextSerializationUnit.isTextElement((Element) node)) { return TextSerializationUnit.getText((Element) node); } else { throw new SmooksException("Unsupported 'bindTo' or toOutStream templating action. The bind data must be attached to a DOM Text node, or already bound to a <context-object> element."); } }
public void writeElementEnd(Element element, Writer writer) throws IOException { writeElementEnd(element, writer, null); }
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException { writeElementStart(element, writer); }
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException { String key = getContextKey(element); if(key != null) { Object object = executionContext.getAttribute(key); if(object != null) { writer.write(object.toString()); } else { logger.debug("Invalid <context-object> specification at '" + DomUtils.getXPath(element) + "'. No Object instance found on context at '" + key + "'."); } } else { logger.warn("Invalid <context-object> specification at '" + DomUtils.getXPath(element) + "'. 'key' attribute not specified."); } }
public void writeElementStart(Element element, Writer writer) throws IOException { writer.write((int)'<'); writer.write(element.getTagName()); writeAttributes(element.getAttributes(), writer); if(closeEmptyElements && !element.hasChildNodes()) { // Do nothing. We'll close it "short-hand" in writeElementEnd below... } else { writer.write((int)'>'); } }
@Override protected void visit(Element element, ExecutionContext executionContext) { // First thing we do is clone the template for this transformation... StringTemplate thisTransTemplate = template.getInstanceOf(); Map<String, Object> beans = executionContext.getBeanContext().getBeanMap(); String templatingResult; Node resultNode; // Set the document data beans on the template and apply it... thisTransTemplate.setAttributes(beans); templatingResult = thisTransTemplate.toString(); resultNode = TextSerializationUnit.createTextElement(element, templatingResult); // Process the templating action, supplying the templating result... processTemplateAction(element, resultNode, executionContext); }
public void writeElementEnd(Element element, Writer writer) throws IOException { writeElementEnd(element, writer, null); }
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException { writeElementStart(element, writer); }
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException { String key = getContextKey(element); if(key != null) { Object object = executionContext.getAttribute(key); if(object != null) { writer.write(object.toString()); } else { logger.debug("Invalid <context-object> specification at '" + DomUtils.getXPath(element) + "'. No Object instance found on context at '" + key + "'."); } } else { logger.warn("Invalid <context-object> specification at '" + DomUtils.getXPath(element) + "'. 'key' attribute not specified."); } }
public void writeElementStart(Element element, Writer writer) throws IOException { writer.write((int)'<'); writer.write(element.getTagName()); writeAttributes(element.getAttributes(), writer); if(closeEmptyElements && !element.hasChildNodes()) { // Do nothing. We'll close it "short-hand" in writeElementEnd below... } else { writer.write((int)'>'); } }
public void writeElementEnd(Element element, Writer writer) throws IOException { writeElementEnd(element, writer, null); }
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException { writeElementStart(element, writer); }
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException { String key = getContextKey(element); if(key != null) { Object object = executionContext.getAttribute(key); if(object != null) { writer.write(object.toString()); } else { logger.debug("Invalid <context-object> specification at '" + DomUtils.getXPath(element) + "'. No Object instance found on context at '" + key + "'."); } } else { logger.warn("Invalid <context-object> specification at '" + DomUtils.getXPath(element) + "'. 'key' attribute not specified."); } }
public void writeElementStart(Element element, Writer writer) throws IOException { writer.write((int)'<'); writer.write(element.getTagName()); writeAttributes(element.getAttributes(), writer); if(closeEmptyElements && !element.hasChildNodes()) { // Do nothing. We'll close it "short-hand" in writeElementEnd below... } else { writer.write((int)'>'); } }