/** * Write the element text to any {@link StreamResult} instance that may have been supplied to the * {@link Smooks#filterSource(javax.xml.transform.Source, javax.xml.transform.Result) Smooks.filterSource()} * method. * <p/> * <a href="#writing-text">See about writing text</a>. * * @param element The element. * @throws IOException Exception writing. */ public void writeText(SAXElement element) throws IOException { writeText(element, element.getWriter(owner)); }
private static <U> void processStreamResultWriterAnnotations(U instance, SmooksResourceConfiguration config) { if(!(instance instanceof SAXVisitor)) { return; } List<Field> streamResFields = ClassUtil.getAnnotatedFields(instance.getClass(), StreamResultWriter.class); boolean encodeSpecialCharacters = config.getBoolParameter(Filter.ENTITIES_REWRITE, true); for(Field streamResField : streamResFields) { // If already initialized, ignore... try { if(ClassUtil.getField(streamResField, instance) != null) { continue; } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to get property field value for '" + getLongMemberName(streamResField) + "'.", e); } Class<?> type = streamResField.getType(); if(type == SAXToXMLWriter.class) { SAXToXMLWriter xmlWriter = new SAXToXMLWriter((SAXVisitor) instance, encodeSpecialCharacters); try { ClassUtil.setField(streamResField, instance, xmlWriter); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to inject SAXToXMLWriter property field value for '" + getLongMemberName(streamResField) + "'.", e); } } } }
private static <U> void processStreamResultWriterAnnotations(U instance, SmooksResourceConfiguration config) { if(!(instance instanceof SAXVisitor)) { return; } List<Field> streamResFields = ClassUtil.getAnnotatedFields(instance.getClass(), StreamResultWriter.class); boolean encodeSpecialCharacters = config.getBoolParameter(Filter.ENTITIES_REWRITE, true); for(Field streamResField : streamResFields) { // If already initialized, ignore... try { if(ClassUtil.getField(streamResField, instance) != null) { continue; } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to get property field value for '" + getLongMemberName(streamResField) + "'.", e); } Class<?> type = streamResField.getType(); if(type == SAXToXMLWriter.class) { SAXToXMLWriter xmlWriter = new SAXToXMLWriter((SAXVisitor) instance, encodeSpecialCharacters); try { ClassUtil.setField(streamResField, instance, xmlWriter); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to inject SAXToXMLWriter property field value for '" + getLongMemberName(streamResField) + "'.", e); } } } }
/** * Write the element text to any {@link StreamResult} instance that may have been supplied to the * {@link Smooks#filterSource(javax.xml.transform.Source, javax.xml.transform.Result) Smooks.filterSource()} * method. * <p/> * <a href="#writing-text">See about writing text</a>. * * @param element The element. * @throws IOException Exception writing. */ public void writeText(SAXElement element) throws IOException { writeText(element, element.getWriter(owner)); }
private static <U> void processStreamResultWriterAnnotations(U instance, SmooksResourceConfiguration config) { if(!(instance instanceof SAXVisitor)) { return; } List<Field> streamResFields = ClassUtil.getAnnotatedFields(instance.getClass(), StreamResultWriter.class); boolean encodeSpecialCharacters = config.getBoolParameter(Filter.ENTITIES_REWRITE, true); for(Field streamResField : streamResFields) { // If already initialized, ignore... try { if(ClassUtil.getField(streamResField, instance) != null) { continue; } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to get property field value for '" + getLongMemberName(streamResField) + "'.", e); } Class<?> type = streamResField.getType(); if(type == SAXToXMLWriter.class) { SAXToXMLWriter xmlWriter = new SAXToXMLWriter((SAXVisitor) instance, encodeSpecialCharacters); try { ClassUtil.setField(streamResField, instance, xmlWriter); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to inject SAXToXMLWriter property field value for '" + getLongMemberName(streamResField) + "'.", e); } } } }
/** * Write the element text to any {@link StreamResult} instance that may have been supplied to the * {@link Smooks#filterSource(javax.xml.transform.Source, javax.xml.transform.Result) Smooks.filterSource()} * method. * <p/> * <a href="#writing-text">See about writing text</a>. * * @param element The element. * @throws IOException Exception writing. */ public void writeText(SAXElement element) throws IOException { writeText(element, element.getWriter(owner)); }
private static <U> void processStreamResultWriterAnnotations(U instance, SmooksResourceConfiguration config) { if(!(instance instanceof SAXVisitor)) { return; } List<Field> streamResFields = ClassUtil.getAnnotatedFields(instance.getClass(), StreamResultWriter.class); boolean encodeSpecialCharacters = config.getBoolParameter(Filter.ENTITIES_REWRITE, true); for(Field streamResField : streamResFields) { // If already initialized, ignore... try { if(ClassUtil.getField(streamResField, instance) != null) { continue; } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to get property field value for '" + getLongMemberName(streamResField) + "'.", e); } Class<?> type = streamResField.getType(); if(type == SAXToXMLWriter.class) { SAXToXMLWriter xmlWriter = new SAXToXMLWriter((SAXVisitor) instance, encodeSpecialCharacters); try { ClassUtil.setField(streamResField, instance, xmlWriter); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to inject SAXToXMLWriter property field value for '" + getLongMemberName(streamResField) + "'.", e); } } } }
public void writeText(SAXElement element) throws IOException { writeText(element, element.getWriter(owner)); }