Committing patch in XALANJ-2278 to add a method to
NamespaceMapping
diff --git a/src/org/apache/xml/serializer/NamespaceMappings.java b/src/org/apache/xml/serializer/NamespaceMappings.java
index f9e3588..a8b7225 100644
--- a/src/org/apache/xml/serializer/NamespaceMappings.java
+++ b/src/org/apache/xml/serializer/NamespaceMappings.java
@@ -526,5 +526,31 @@
m_namespaces.put(prefix, fs);
return fs;
}
-
+
+ /**
+ * Given a namespace uri, get all prefixes bound to the Namespace URI in the current scope.
+ *
+ * @param uri the namespace URI to be search for
+ * @return An array of Strings which are
+ * all prefixes bound to the namespace URI in the current scope.
+ * An array of zero elements is returned if no prefixes map to the given
+ * namespace URI.
+ */
+ public String[] lookupAllPrefixes(String uri)
+ {
+ java.util.ArrayList foundPrefixes = new java.util.ArrayList();
+ Enumeration prefixes = m_namespaces.keys();
+ while (prefixes.hasMoreElements())
+ {
+ String prefix = (String) prefixes.nextElement();
+ String uri2 = lookupNamespace(prefix);
+ if (uri2 != null && uri2.equals(uri))
+ {
+ foundPrefixes.add(prefix);
+ }
+ }
+ String[] prefixArray = new String[foundPrefixes.size()];
+ foundPrefixes.toArray(prefixArray);
+ return prefixArray;
+ }
}