Example #1
0
        private void WriteElement(XmlWriter writer, XmlElement element, List <StyleResource> styleResources)
        {
            writer.WriteStartElement(ToLowerNamespace(element.LocalName));
            foreach (XmlAttribute attr in element.Attributes)
            {
                WriteAttribute(writer, attr, styleResources);
            }

            foreach (XmlElement child in element.Children)
            {
                WriteElement(writer, child, styleResources);
            }
            writer.WriteEndElement();
        }
Example #2
0
        public void Write(XmlElement root, string outputFile, List<StyleResource> styleResources)
        {
            XmlWriterSettings settings = new XmlWriterSettings
            {
                Encoding = Encoding.UTF8,
                Indent = true,
                IndentChars = "\t",
                NewLineChars = "\n",
                NewLineHandling = NewLineHandling.Replace
            };
            _nsDictionary.Clear();
            using (XmlWriter writer = XmlWriter.Create(outputFile, settings))
            {
                writer.WriteStartDocument();

                WriteElement(writer, root, styleResources);

                writer.WriteEndDocument();
            }
        }
Example #3
0
        public void Write(XmlElement root, string outputFile, List <StyleResource> styleResources)
        {
            XmlWriterSettings settings = new XmlWriterSettings
            {
                Encoding        = Encoding.UTF8,
                Indent          = true,
                IndentChars     = "\t",
                NewLineChars    = "\n",
                NewLineHandling = NewLineHandling.Replace
            };

            _nsDictionary.Clear();
            using (XmlWriter writer = XmlWriter.Create(outputFile, settings))
            {
                writer.WriteStartDocument();

                WriteElement(writer, root, styleResources);

                writer.WriteEndDocument();
            }
        }
Example #4
0
 public static bool IsStyleTag(XmlElement element)
 {
     return IsTagNamed(element, STYLE_TAG);
 }
Example #5
0
 public static bool IsResourceTag(XmlElement element)
 {
     return IsTagNamed(element, RESOURCE_TAG);
 }
Example #6
0
 public static bool IsFragmentTag(XmlElement element)
 {
     return IsTagNamed(element, FRAGMENT_TAG);
 }
Example #7
0
 public static bool IsDataTemplateTag(XmlElement element)
 {
     return IsTagNamed(element, DATATEMPLATE_TAG);
 }
Example #8
0
 public static XmlAttribute GetResourceKeyAttribute(XmlElement element)
 {
     return element.Attributes.FirstOrDefault(IsResourceKeyAttribute);
 }
Example #9
0
 private static bool IsTagNamed(XmlElement element, string name)
 {
     return name.Equals(element.LocalName, StringComparison.InvariantCultureIgnoreCase);
 }
Example #10
0
        private void WriteElement(XmlWriter writer, XmlElement element, List<StyleResource> styleResources)
        {
            writer.WriteStartElement(ToLowerNamespace(element.LocalName));
            foreach (XmlAttribute attr in element.Attributes)
            {
                WriteAttribute(writer, attr, styleResources);
            }

            foreach (XmlElement child in element.Children)
            {
                WriteElement(writer, child, styleResources);
            }
            writer.WriteEndElement();
        }