question: protected void addAttributes ( Element element , Attributes attributes ) { boolean noNamespaceAttributes = false ; if ( element instanceof AbstractElement ) { AbstractElement baseElement = ( AbstractElement ) element ; baseElement . setAttributes ( attributes , namespaceStack , noNamespaceAttributes ) ; } else { int size = attributes . getLength ( ) ; for ( int i = 0 ; i < size ; i ++ ) { String attributeQName = attributes . getQName ( i ) ; if ( noNamespaceAttributes || ! attributeQName . startsWith ( "xmlns" ) ) { String attributeURI = attributes . getURI ( i ) ; String attributeLocalName = attributes . getLocalName ( i ) ; String attributeValue = attributes . getValue ( i ) ; QName qName = namespaceStack . getAttributeQName ( attributeURI , attributeLocalName , attributeQName ) ; element . addAttribute ( qName , attributeValue ) ; } } } }
target:  Add all the attributes to the given elements