private void FlushAttributes() {
int idx = 0, idxNext;
string localName;
while (idx != this.numEntries) {
// Get index of next attribute's name (0 if this is the last attribute)
idxNext = this.arrAttrs[idx].NextNameIndex;
if (idxNext == 0)
idxNext = this.numEntries;
// If localName is null, then this is a duplicate attribute that has been marked as "deleted"
localName = this.arrAttrs[idx].LocalName;
if (localName != null) {
string prefix = this.arrAttrs[idx].Prefix;
string ns = this.arrAttrs[idx].Namespace;
this.wrapped.WriteStartAttribute(prefix, localName, ns);
// Output all of this attribute's text or typed values
while (++idx != idxNext) {
string text = this.arrAttrs[idx].Text;
if (text != null)
this.wrapped.WriteString(text);
else
this.wrapped.WriteValue(this.arrAttrs[idx].Value);
}
this.wrapped.WriteEndAttribute();
}
else {
// Skip over duplicate attributes
idx = idxNext;
}
}
// Notify event listener that attributes have been flushed
if (this.onRemove != null)
this.onRemove(this.wrapped);
}