if(prefix == null) {
prefix = Constants.EMPTY_STRING;
}
String uri = resolveNamespacePrefix(prefix);
if((uri == null && elem.getNamespaceURI() != null) || (uri != null && !uri.equals(elem.getNamespaceURI()))) {
NamespaceResolver tmpresolver = getTempResolver(elem);
tmpresolver.put(prefix, elem.getNamespaceURI());
if (!nsresolverList.contains(tmpresolver)) {
nsresolverList.add(tmpresolver);
}
String namespaceURI = elem.getNamespaceURI();
if(null == namespaceURI) {
namespaceURI = Constants.EMPTY_STRING;
}
getContentHandler().startPrefixMapping(prefix, namespaceURI);
}
NamedNodeMap attributes = elem.getAttributes();
if(attributes != null) {
for(int x=0; x < attributes.getLength(); x++) {
Node attribute = attributes.item(x);
if(XMLConstants.XMLNS_ATTRIBUTE.equals(attribute.getPrefix())) {
NamespaceResolver tmpresolver = getTempResolver(elem);
tmpresolver.put(attribute.getLocalName(), attribute.getNodeValue());
if (!nsresolverList.contains(tmpresolver)) {
nsresolverList.add(tmpresolver);
}
} else if(XMLConstants.XMLNS_ATTRIBUTE.equals(attribute.getNodeName())) {
NamespaceResolver tmpresolver = getTempResolver(elem);
String namespace = attribute.getNodeValue();
if(null == namespace) {
namespace = Constants.EMPTY_STRING;
}
tmpresolver.put(Constants.EMPTY_STRING, namespace);
if (!nsresolverList.contains(tmpresolver)) {
nsresolverList.add(tmpresolver);
}
}
}