Friday, March 18, 2011

JAXB, retrieving the Namespace of an element

I hate hardcoding namespaces in my code, so here is how to retrieve it from the JAXB annotated beans:


ObjectFactory oj = new ObjectFactory();
String NAMESPACE = oj.createMyObject(oj.createMyObject()).getName().getNamespaceURI();


No comments: