Exemplo n.º 1
0
        private void CopyOrOverrideAttributes(XmlWriter xmlWriter, IEnumerable <PropValue> propValueOverrides)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            Util.AddRange <KeyValuePair <string, object>, KeyValuePair <string, object> >(dictionary, MasterCategoryListSerializer.PropValuesToAttributeNameValues(propValueOverrides));
            while (this.xmlReader.MoveToNextAttribute())
            {
                if (this.IsFromCategoriesNamespace())
                {
                    object value;
                    if (dictionary.TryGetValue(this.xmlReader.LocalName, out value))
                    {
                        dictionary.Remove(this.xmlReader.LocalName);
                        MasterCategoryListSerializer.WriteAttributeForProperty(xmlWriter, this.xmlReader.LocalName, value);
                    }
                    else
                    {
                        xmlWriter.WriteAttributeString(this.xmlReader.LocalName, this.xmlReader.Value);
                    }
                }
                else
                {
                    xmlWriter.WriteAttributeString(this.xmlReader.Prefix, this.xmlReader.LocalName, this.xmlReader.NamespaceURI, this.xmlReader.Value);
                }
            }
            MasterCategoryListSerializer.WriteAttributesForProperties(xmlWriter, dictionary);
            this.xmlReader.MoveToElement();
        }
Exemplo n.º 2
0
 private static void WriteAttributesForProperties(XmlWriter xmlWriter, IEnumerable <KeyValuePair <string, object> > attrNameToValues)
 {
     foreach (KeyValuePair <string, object> keyValuePair in attrNameToValues)
     {
         MasterCategoryListSerializer.WriteAttributeForProperty(xmlWriter, keyValuePair.Key, keyValuePair.Value);
     }
 }