if (nsSupport.getURI(prefix) == null) {
namespaceDecls.put(prefix, namespaceURI);
nsSupport.declarePrefix(prefix, namespaceURI);
}
// check attributes for required namespace declarations
QName attrQName;
String uri;
if(attribs != null) {
for (int i = 0; i < attribs.getLength(); i++) {
attrQName = attribs.getQName(i);
if ("xmlns".equals(attrQName.getLocalName())) {
if (nsSupport.getURI("") == null) {
uri = attribs.getValue(i);
if (enforceXHTML && !XHTML_NS.equals(uri)) {
uri = XHTML_NS;
}
namespaceDecls.put("", uri);
nsSupport.declarePrefix("", uri);
}
} else if (attrQName.getPrefix() != null && attrQName.getPrefix().length() > 0) {
prefix = attrQName.getPrefix();
if("xmlns:".equals(prefix)) {
if (nsSupport.getURI(prefix) == null) {
uri = attribs.getValue(i);
prefix = attrQName.getLocalName();
namespaceDecls.put(prefix, uri);
nsSupport.declarePrefix(prefix, uri);
}
} else {
if (nsSupport.getURI(prefix) == null) {
uri = attrQName.getNamespaceURI();
namespaceDecls.put(prefix, uri);
nsSupport.declarePrefix(prefix, uri);
}
}
}