Commit c132ed53 authored by Tebjan Halm's avatar Tebjan Halm
Browse files

GetXML method also makes sure it uses invariant culture for serialization

parent 11c363d8
...@@ -5,6 +5,8 @@ using System.Text; ...@@ -5,6 +5,8 @@ using System.Text;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using System.Threading;
using System.Globalization;
namespace Svg namespace Svg
{ {
...@@ -39,13 +41,22 @@ namespace Svg ...@@ -39,13 +41,22 @@ namespace Svg
public static string GetXML(this SvgElement elem) public static string GetXML(this SvgElement elem)
{ {
var result = "";
var currentCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
using (StringWriter str = new StringWriter()) using (StringWriter str = new StringWriter())
using (XmlTextWriter xml = new XmlTextWriter(str))
{ {
elem.WriteElement(xml); using (XmlTextWriter xml = new XmlTextWriter(str))
return str.ToString(); {
elem.WriteElement(xml);
result = str.ToString();
}
} }
Thread.CurrentThread.CurrentCulture = currentCulture;
return result;
} }
public static bool HasNonEmptyCustomAttribute(this SvgElement element, string name) public static bool HasNonEmptyCustomAttribute(this SvgElement element, string name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment