// Token: 0x060020ED RID: 8429 RVA: 0x00097364 File Offset: 0x00095564
        public void WriteXmlnsProperty(string localName, string xmlNamespace)
        {
            this.VerifyWriteState();
            BamlRecordType bamlRecordType = this.PeekRecordType();

            if (bamlRecordType != BamlRecordType.ElementStart && bamlRecordType != BamlRecordType.PropertyComplexStart && bamlRecordType != BamlRecordType.PropertyArrayStart && bamlRecordType != BamlRecordType.PropertyIListStart && bamlRecordType != BamlRecordType.PropertyIDictionaryStart)
            {
                throw new InvalidOperationException(SR.Get("BamlWriterBadXmlns", new object[]
                {
                    "WriteXmlnsProperty",
                    bamlRecordType.ToString()
                }));
            }
            XamlXmlnsPropertyNode xamlXmlnsPropertyNode = new XamlXmlnsPropertyNode(0, 0, this._depth, localName, xmlNamespace);

            this._bamlRecordWriter.WriteNamespacePrefix(xamlXmlnsPropertyNode);
            this._parserContext.XmlnsDictionary[localName] = xmlNamespace;
        }
Пример #2
0
 /// <summary>
 /// Write xml namespace declaration information to baml.
 /// </summary>
 /// <remarks>
 /// This is used for setting the default namespace, or for mapping
 /// a namespace prefix (or localName) to a namespace.  If prefix is 
 /// an empty string, then this sets the default namespace.
 /// </remarks>
 public void WriteXmlnsProperty(
     string  localName,
     string  xmlNamespace)
 {
     VerifyWriteState();
     
     BamlRecordType parentType = PeekRecordType();
     if (parentType != BamlRecordType.ElementStart &&
         parentType != BamlRecordType.PropertyComplexStart &&
         parentType != BamlRecordType.PropertyArrayStart &&
         parentType != BamlRecordType.PropertyIListStart &&
         parentType != BamlRecordType.PropertyIDictionaryStart)
     {
         throw new InvalidOperationException(SR.Get(SRID.BamlWriterBadXmlns,
                                                    "WriteXmlnsProperty",
                                                    parentType.ToString()));
     }
     
     XamlXmlnsPropertyNode xmlnsNode = new XamlXmlnsPropertyNode(
                                             0,
                                             0,
                                             _depth,
                                             localName,
                                             xmlNamespace);
 
     _bamlRecordWriter.WriteNamespacePrefix(xmlnsNode);
     _parserContext.XmlnsDictionary[localName] = xmlNamespace;
 }