Java tutorial
//package com.java2s; //License from project: Open Source License import java.lang.annotation.Annotation; import javax.xml.bind.annotation.XmlSchema; public class Main { 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; } }