List of utility methods to do XML Namespace
String | getNamespace(Class> klass) get Namespace String namespace = null; 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; |
String | getNamespace(final Package targetPackage) get Namespace String namespaceURI; if (targetPackage == null) { namespaceURI = ""; } else { final XmlSchema xmlSchemaAnnotation = targetPackage.getAnnotation(XmlSchema.class); if (xmlSchemaAnnotation == null) { namespaceURI = ""; } else { ... |
QName | getNamespace(Map get Namespace String prefix = null; String localName = null; StringTokenizer tokenizer = new StringTokenizer(str, ":"); if (tokenizer.countTokens() == 2) { prefix = tokenizer.nextToken(); localName = tokenizer.nextToken(); } else if (tokenizer.countTokens() == 1) { localName = tokenizer.nextToken(); ... |
NamespaceContext | getNamespaceContext() get Namespace Context return namespaceContext;
|
NamespaceContext | getNamespaceContext(final String prefix, final String uri) get Namespace Context return new NamespaceContext() { @Override public String getNamespaceURI(String prefix) { return uri; @Override public String getPrefix(String uri) { return prefix; ... |
NamespaceContext | getNamespaceCtx() get Namespace Ctx return new NamespaceContext() { @Override public String getNamespaceURI(String prefix) { switch (prefix) { case "asic": return NS_ASIC; case "ds": return NS_DS; ... |
List | getNamespacesForClass(final Class get Namespaces For Class final List<String> namespaces = new ArrayList<String>(); final XmlSeeAlso seeAlso = clazz.getAnnotation(XmlSeeAlso.class); if (seeAlso != null) { for (final Class<?> c : seeAlso.value()) { namespaces.addAll(getNamespacesForClass(c)); return namespaces; ... |
String | getNamespaceURI(Name name) get Namespace URI String uri = name.getURI();
return uri == null || uri.length() == 0 ? null : uri;
|
String | getPackageNamespace(Class> cls) get Package Namespace Package p = cls.getPackage(); if (p != null) { javax.xml.bind.annotation.XmlSchema schemaAnn = p .getAnnotation(javax.xml.bind.annotation.XmlSchema.class); if (schemaAnn != null) { return schemaAnn.namespace(); return null; |
String | getPrefix(final Package targetPackage, String namespaceURI) get Prefix String prefix; final Map<String, String> namespacePrefixes = new HashMap<String, String>(); if (targetPackage != null) { final XmlSchema xmlSchemaAnnotation = targetPackage.getAnnotation(XmlSchema.class); if (xmlSchemaAnnotation != null) { for (XmlNs xmlns : xmlSchemaAnnotation.xmlns()) { namespacePrefixes.put(xmlns.namespaceURI(), xmlns.prefix()); prefix = namespacePrefixes.get(namespaceURI); return prefix; |