_handler.namespaceAfterStartElement(prefix, uriAttr);
}
}
// Process all non-namespace attributes next
NamespaceMappings nm = new NamespaceMappings();
for (int i = 0; i < length; i++) {
final Node attr = map.item(i);
final String qnameAttr = attr.getNodeName();
// Is this a regular attribute?
if (!qnameAttr.startsWith(XMLNS_PREFIX)) {
final String uriAttr = attr.getNamespaceURI();
// Uri may be implicitly declared
if (uriAttr != null && !uriAttr.equals(EMPTYSTRING) ) {
colon = qnameAttr.lastIndexOf(':');
// Fix for bug 26319
// For attributes not given an prefix explictly
// but having a namespace uri we need
// to explicitly generate the prefix
String newPrefix = nm.lookupPrefix(uriAttr);
if (newPrefix == null)
newPrefix = nm.generateNextPrefix();
prefix = (colon > 0) ? qnameAttr.substring(0, colon)
: newPrefix;
_handler.namespaceAfterStartElement(prefix, uriAttr);
_handler.addAttribute((prefix + ":" + qnameAttr),
attr.getNodeValue());