&& (attName.charAt(3) == 'n')
&& (attName.charAt(4) == 's')) {
String value = attr.deferredValue;
String prefix = (attName.length() > 5) ? attName
.substring(6) : "";
CNamespace ns = new CNamespace(prefix, value);
if (this.cHandler != null) {
try {
this.cHandler.startPrefixMapping(ns.getPrefix(), ns
.getNamespaceURI());
}
catch (SAXException e){}
} // end if
if (this.level > this.maxLevel) {
this.maxLevel = this.level;
}
this.nsMap.put(new CStringBuilder().append(ns.getPrefix())
.append(sLevel).toString(), ns);
} // end if
} // end for
} // end if
CNamespace ns = null;
if (prefixTag != null) {
int i = (this.maxLevel < this.level) ? this.maxLevel : this.level;
prefixTag = new CStringBuilder().append(prefixTag).append('$')
.toString();
while ((i > 0) && (ns == null)) {
ns = (CNamespace) this.nsMap.get(new CStringBuilder().append(
prefixTag).append(i).toString());
i--;
} // end while
} // end if
else {
int i = (this.maxLevel < this.level) ? this.maxLevel : this.level;
while ((i > 0) && (ns == null)) {
ns = (CNamespace) this.nsMap.get(new CStringBuilder().append(
'$').append(i).toString());
i--;
} // end while
} // end else
if (attributes != null) {
for (int li = 0; li < count; li++) {
CAttr attr = attributes[li];
String attName = attr.name;
String value = attr.deferredValue;
if (value == null) {
value = "";
}
// Patch Tom Fennelly, check if decoding needed.
if (this.decodeEntites && (value.indexOf('&') != -1)) {
value = this.codec.decodeInternal(value, null, null,
this.dtdHandler, true);
} else {
if (this.dtdHandler != null) {
value = this.codec.decodeInternal(value, null, null,
this.dtdHandler, false);
} // end if
} // end else
if ((attName.length() >= 5) && (attName.charAt(0) == 'x')
&& (attName.charAt(1) == 'm')
&& (attName.charAt(2) == 'l')
&& (attName.charAt(3) == 'n')
&& (attName.charAt(4) == 's') && (!this.nPrefix)) {
continue;
}
int indexOf2p = attName.indexOf(":");
CNamespace nsToSet = null;
String prefix = "";
String aname = attName;
if (indexOf2p != -1) {
prefix = attName.substring(0, indexOf2p);
aname = attName.substring(indexOf2p + 1);
int i = (this.maxLevel < this.level) ? this.maxLevel
: this.level;
prefix = new CStringBuilder().append(prefix).append('$')
.toString();
while ((i > 0) && (nsToSet == null)) {
nsToSet = (CNamespace) this.nsMap
.get(new CStringBuilder().append(prefix)
.append(i).toString());
i--;
} // end while
} // end if
else {
int i = (this.maxLevel < this.level) ? this.maxLevel
: this.level;
while ((i > 0) && (nsToSet == null)) {
nsToSet = (CNamespace) this.nsMap
.get(new CStringBuilder().append('$').append(i)
.toString());
i--;
} // end while
} // end else
if (nsToSet != null) {
this.atts.addAttribute(nsToSet.getNamespaceURI(), aname,
attName, "CDATA", value);
} // end if
else {
this.atts.addAttribute("", aname, aname, "CDATA", value);
} // end else