System.Xml.XmlWellFormedWriter.WriteQualifiedName C# (CSharp) Méthode

WriteQualifiedName() public méthode

public WriteQualifiedName ( string localName, string ns ) : void
localName string
ns string
Résultat void
        public override void WriteQualifiedName(string localName, string ns)
        {
            try
            {
                if (localName == null || localName.Length == 0)
                {
                    throw new ArgumentException(SR.Xml_EmptyLocalName);
                }
                CheckNCName(localName);

                AdvanceState(Token.Text);
                string prefix = String.Empty;
                if (ns != null && ns.Length != 0)
                {
                    prefix = LookupPrefix(ns);
                    if (prefix == null)
                    {
                        if (_currentState != State.Attribute)
                        {
                            throw new ArgumentException(SR.Format(SR.Xml_UndefNamespace, ns));
                        }
                        prefix = GeneratePrefix();
                        PushNamespaceImplicit(prefix, ns);
                    }
                }
                // if this is a special attribute, then just convert this to text
                // otherwise delegate to raw-writer
                if (SaveAttrValue || _rawWriter == null)
                {
                    if (prefix.Length != 0)
                    {
                        WriteString(prefix);
                        WriteString(":");
                    }
                    WriteString(localName);
                }
                else
                {
                    _rawWriter.WriteQualifiedName(prefix, localName, ns);
                }
            }
            catch
            {
                _currentState = State.Error;
                throw;
            }
        }