protected String getOrCreatePrefix()

in src/main/java/org/apache/neethi/builders/PrimitiveAssertion.java [301:318]


    protected String getOrCreatePrefix(String ns, XMLStreamWriter writer) throws XMLStreamException {
        if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(ns)) {
            return null;
        }
        String prefix = writer.getPrefix(ns);
        int count = 1;
        while (prefix == null || "".equals(prefix)) {
            prefix = "ns" + count++;
            String ns2 =  writer.getNamespaceContext().getNamespaceURI(prefix);
            if (ns2 == null || "".equals(ns2)) {
                //found one that will work
                writer.writeNamespace(prefix, ns);
            } else {
                prefix = null;
            }
        }
        return prefix;
    }