Updated the WrapperElement code to use the generated runtime since the
old one does not run anymore (requires deprecated classes
com.sun.xml.bind.serializer.XMLSerializ*
--------
import your_gen_packages_here.impl.runtime.XMLSerializable;
import your_gen_packages_here.impl.runtime.XMLSerializer;
/**
* Use it to wrap ComplexTypes (or even other Elements) inside a new element
* (neccessary since JAXB-1.x cannot marshall complexTypes correctly).
*/
public class ElementWrapper implements XMLSerializable {
private XMLSerializable wrappedElement;
private String namespace;
private String elementName;
public ElementWrapper(String namespace, String elementName,
XMLSerializable objectToWrap) {
this.wrappedElement = objectToWrap;
this.namespace = namespace;
this.elementName = elementName;
}
public void serializeBody(XMLSerializer context)
throws org.xml.sax.SAXException {
context.startElement(namespace, elementName);
wrappedElement.serializeURIs(context);
context.endNamespaceDecls();
wrappedElement.serializeAttributes(context);
context.endAttributes();
wrappedElement.serializeBody(context);
context.endElement();
}
public void serializeAttributes(XMLSerializer context) {
}
public void serializeURIs(XMLSerializer context) {
}
}