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, 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."); } }
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, 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."); } }