JAXB - Move dynamically generated namespaces to document root



I've got this POJO:



public class SimpleElement {

private Namespace namespace;
private String tagName;
private String value;
private Collection<Attribute> attributes;

/* getters/setters/... */


And for completeness, Attribute



public class Attribute {

private String name;
private String value;
private Namespace namespace;


And Namespace:



public class Namespace {

private final String uri;
private final String prefix;


SimpleElementAdapter serializes a SimpleElement into its org.w3c.dom.Element counterpart.


The only problem with this approach is that namespaces always end up at element level, never at document root.


Is there a way to dynamically declare namespaces at document root?


No comments:

Post a Comment