Here you can find the source of getNamespace(Class> klass)
public static String getNamespace(Class<?> klass)
//package com.java2s; //License from project: Open Source License import javax.xml.bind.annotation.XmlSchema; import javax.xml.bind.annotation.XmlType; public class Main { public final static String DEFAULT_NAMESPACE_VALUE = "##default"; public static String getNamespace(Class<?> klass) { String namespace = null;/* w w w . j ava2s. c om*/ XmlType xmlType = klass.getAnnotation(XmlType.class); if (xmlType != null) { String ns = xmlType.namespace(); if (!DEFAULT_NAMESPACE_VALUE.equals(ns)) { namespace = ns; } } if (namespace == null) { namespace = DEFAULT_NAMESPACE_VALUE; Package pkg = klass.getPackage(); XmlSchema xmlSchema = pkg.getAnnotation(XmlSchema.class); if (xmlSchema != null) { namespace = xmlSchema.namespace(); } } return namespace; } }