if (field != null) {
root = (Element) XPathEngine.getInstance().create((XMLField) getField(), root, session);
}
List extraNamespaces = new ArrayList();
NamespaceResolver nr = row.getNamespaceResolver();
for (Object iter = cp.iteratorFor(attributeValue); cp.hasNext(iter);) {
Object key = cp.next(iter, session);
if ((key != null) && key instanceof QName) {
Object value = cp.valueFromKey(key, attributeValue);
QName attributeName = (QName) key;
String namespaceURI = attributeName.getNamespaceURI();
String qualifiedName = attributeName.getLocalPart();
if (nr != null) {
String prefix = nr.resolveNamespaceURI(attributeName.getNamespaceURI());
if ((prefix != null) && !prefix.equals("")) {
qualifiedName = prefix + ":" + qualifiedName;
} else if (attributeName.getNamespaceURI() != null && !attributeName.getNamespaceURI().equals("")) {
String generatedPrefix = nr.generatePrefix();
qualifiedName = generatedPrefix + ":" + qualifiedName;
nr.put(generatedPrefix, attributeName.getNamespaceURI());
extraNamespaces.add(new Namespace(generatedPrefix, attributeName.getNamespaceURI()));
row.getNamespaceResolver().put(generatedPrefix, attributeName.getNamespaceURI());
}
}
if (namespaceURI != null) {