Пример #1
0
  /**
   * Determine the original namespace of the given qualified name with a namespace previously mapped
   * with {@link #map(QName)} and return the original name.
   *
   * @param mapped the adapted qualified name
   * @return the original qualified name
   */
  public static QName unmap(QName mapped) {
    if (XMLConstants.NULL_NS_URI.equals(mapped.getNamespaceURI())) {
      return mapped;
    }

    return new QName(IDS.getObject(mapped.getNamespaceURI()), mapped.getLocalPart());
  }
Пример #2
0
 /**
  * Decode a name based on the runtime namespace map.
  *
  * @param name the encoded name
  * @return the decoded qualified name
  * @throws DecoderException of decoding the local part of the name fails
  */
 public static QName decode(String name) throws DecoderException {
   int pos = name.indexOf('_'); // find first underscore
   String local;
   String ns = XMLConstants.NULL_NS_URI;
   if (pos < 0) {
     local = ONameUtil.decodeName(name);
   } else {
     ns = IDS.getObject(name.substring(0, pos));
     local = ONameUtil.decodeName(name.substring(pos + 1));
   }
   return new QName(ns, local);
 }