public override void WriteQualifiedName(string localName, string ns) {
try {
AutoComplete(Token.Content);
if (this.namespaces) {
if (ns != null && ns.Length != 0 && ns != stack[top].defaultNs) {
string prefix = FindPrefix(ns);
if (prefix == null) {
if (this.currentState != State.Attribute) {
throw new ArgumentException(Res.GetString(Res.Xml_UndefNamespace, ns));
}
prefix = GeneratePrefix(); // need a prefix if
PushNamespace(prefix, ns, false);
}
if (prefix.Length != 0) {
InternalWriteName(prefix, true);
textWriter.Write(':');
}
}
}
else if (ns != null && ns.Length != 0) {
throw new ArgumentException(Res.GetString(Res.Xml_NoNamespaces));
}
InternalWriteName(localName, true);
}
catch {
currentState = State.Error;
throw;
}
}