/** * Generates a new namespace prefix for the specified namespace URI that * doesn't collide with any existing prefix. * * @param nsURI The URI for which to generate a prefix. * @param nsCtx The namespace context in which to set the prefix. * @param namespaces A {@link List} of {@link Namespace} events to which the * new prefix will be added. * @return The new prefix. */ private String generatePrefix(String nsURI, SimpleNamespaceContext nsCtx, List namespaces) { String newPrefix; int nsCount = 0; do { newPrefix = "ns" + nsCount; nsCount++; } while (nsCtx.getNamespaceURI(newPrefix) != null); nsCtx.setPrefix(newPrefix, nsURI); namespaces.add(factory.createNamespace(newPrefix, nsURI)); return newPrefix; }
String nsURI = namespaces.getNamespaceURI(prefix); String nsURI = namespaces.getNamespaceURI(attrPrefix); if (nsURI == null) {
String uri = namespaces.getNamespaceURI(prefix);
String boundURI = nsCtx.getNamespaceURI(prefix); if (!nsURI.equals(boundURI)) { String defaultURI = nsCtx.getNamespaceURI(""); if (defaultURI != null && defaultURI.length() > 0) {
String resolvedNS = nsCtx.getNamespaceURI(prefix); if (resolvedNS != null) {
} else if (!nsCtx.getNamespaceURI(prefix).equals(nsURI)) {