private static boolean namespaceMatches(PrefixedName prefixedName,
                                          String uri,
                                          NamespaceContext namespaceContext,
                                          XmlElement context,
                                          boolean allowDefault) {
    if (namespaceContext == null) return true;

    final String namespaceURI;
    if (prefixedName.getPrefix() != null) {
      if (uri == null || uri.length() == 0) return false;

      namespaceURI = namespaceContext.getNamespaceURI(prefixedName.getPrefix(), context);
    } else {
      if (!allowDefault) return (uri == null || uri.length() == 0);

      if ((namespaceURI = namespaceContext.getDefaultNamespace(context)) == null) {
        return (uri == null || uri.length() == 0);
      }
    }
    return uri.equals(namespaceURI);
  }
private static boolean namespaceMatches(PrefixedName prefixedName,
                                          String uri,
                                          NamespaceContext namespaceContext,
                                          XmlElement context,
                                          boolean allowDefault)