/** * Merges a set of {@link Attribute} events, possibly adding additional * {@link Namespace} events if the attribute's prefix isn't bound in the * provided context. * * @param iter An {@link Iterator} of {@link Attribute} events. * @param namespaces A {@link List} to which any new {@link Namespace} * events should be added. * @param attributes A {@link List} to which all {@link Attributes} events * should be merged. */ private void mergeAttributes(Iterator iter, List namespaces, List attributes) { while (iter.hasNext()) { Attribute attr = (Attribute) iter.next(); // check if the attribute QName has the proper mapping QName attrName = attr.getName(); QName newName = processQName(attrName, namespaces); if (!attrName.equals(newName)) { // need to generate a new attribute with the new qualified name Attribute newAttr = factory.createAttribute(newName, attr.getValue()); attributes.add(newAttr); } else { // the attribute is fine attributes.add(attr); } } }
QName newName = processQName(tagName, namespaces);