Example #1
0
 private static final String formatQName(XmlCursor xmlc, QName qName) {
   XmlCursor parent = xmlc.newCursor();
   parent.toParent();
   String prefix = parent.prefixForNamespace(qName.getNamespaceURI());
   parent.dispose();
   String name;
   if (prefix == null || prefix.length() == 0) name = qName.getLocalPart();
   else name = prefix + ":" + qName.getLocalPart();
   return name;
 }
Example #2
0
 public static String getPrefixForNamespace(final XmlObject element, final String namespace) {
   final XmlCursor cursor = element.newCursor();
   final String prefix = cursor.prefixForNamespace(namespace);
   cursor.dispose();
   return prefix;
 }