protected void writeAttributes()

in src/main/java/org/apache/neethi/builders/PrimitiveAssertion.java [274:300]


    protected void writeAttributes(XMLStreamWriter writer) throws XMLStreamException {
        if (attributes != null) {
            for (Map.Entry<QName, String> att : attributes.entrySet()) {
                if (Constants.isIgnorableAttribute(att.getKey())) {
                    //already handled
                    continue;
                }
                if (Constants.isOptionalAttribute(att.getKey())) {
                    //already handled
                    continue;
                }
                if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(att.getKey().getNamespaceURI())) {
                    writer.writeNamespace(att.getKey().getLocalPart(), att.getValue());
                    continue;
                }
                String ns = att.getKey().getNamespaceURI();
                if (ns != null && !"".equals(ns)) {
                    String prefix = getOrCreatePrefix(att.getKey().getNamespaceURI(), writer);
                    writer.writeAttribute(prefix, att.getKey().getNamespaceURI(),
                                          att.getKey().getLocalPart(),
                                          att.getValue());
                } else {
                    writer.writeAttribute(att.getKey().getLocalPart(), att.getValue());
                }
            }
        }
    }