protected Element annotationsToXML(Annotated<?> annotated) throws JDOMException, IOException { AnnotationTools.pruneAnnotations(annotated, new EditsImpl()); Element result = new Element(ANNOTATIONS, T2_WORKFLOW_NAMESPACE); for (AnnotationChain a : annotated.getAnnotations()) { Element annotationChainElement; if (annotationChainIs21(a)) { annotationChainElement = new Element(ANNOTATION_CHAIN, T2_WORKFLOW_NAMESPACE); } else { annotationChainElement = new Element(ANNOTATION_CHAIN_2_2, T2_WORKFLOW_NAMESPACE); } populateBeanElementFromXStream(a, annotationChainElement); result.addContent(annotationChainElement); } return result; }