@SuppressWarnings("unchecked")
final Map.Entry<String, String> namespaces[]
= nsMap.entrySet().toArray(new Map.Entry[nsMap.size()]);
//OK. we have extra namespaces. We'll need to wrapper the reader
//with a new one that will fake extra namespace events
source = new DepthXMLStreamReader(source) {
public int getNamespaceCount() {
if (getDepth() == 0 && isStartElement()) {
return super.getNamespaceCount() + nsMap.size();
}
return super.getNamespaceCount();