Skip to content

Instantly share code, notes, and snippets.

@jonashackt
Created May 5, 2015 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jonashackt/a2ced04a72508b7cf3d0 to your computer and use it in GitHub Desktop.
Save jonashackt/a2ced04a72508b7cf3d0 to your computer and use it in GitHub Desktop.
Get the Namespace-Uri from JAXB-Class-Declaration
public static <T> String getNamespaceUriFromJaxbClass(Class<T> jaxbClass) {
String nsURI = "";
for(Annotation annotation: jaxbClass.getPackage().getAnnotations()){
if(annotation.annotationType() == XmlSchema.class){
nsURI = ((XmlSchema)annotation).namespace();
break;
}
}
return nsURI;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment