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