Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2014-02-27 19:40:11 +0400
committerMarek Safar <marek.safar@gmail.com>2014-02-27 19:40:11 +0400
commit1642d39e9f69d04f87890b21a1de948d6774750a (patch)
treed14a65c8a61885dafd2f597eecda68a3b2312ac5 /mcs/class/System.XML
parent5011900cc3ad5c299ecf185a439e4013fdfd2c38 (diff)
parent43ccb972b4d7c10bf7b0b689914ed4a0ae3e0e06 (diff)
Merge pull request #921 from ermshiperete/novell-bug-594490
Allow qualified names in XmlAttribute serialization
Diffstat (limited to 'mcs/class/System.XML')
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs2
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs26
2 files changed, 27 insertions, 1 deletions
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
index 53a88a46a41..968ad43bf36 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
@@ -862,7 +862,7 @@ namespace System.Xml.Serialization {
else
mapAttribute.AttributeName = atts.XmlAttribute.AttributeName;
- mapAttribute.AttributeName = XmlConvert.EncodeLocalName (mapAttribute.AttributeName);
+ mapAttribute.AttributeName = XmlConvert.EncodeName (mapAttribute.AttributeName);
if (typeData.IsComplexType)
mapAttribute.MappedType = ImportTypeMapping (typeData.Type, null, defaultNamespace);
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs
index 9e1c9f2b52e..3fe094b3901 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs
@@ -2277,6 +2277,32 @@ namespace MonoTests.System.XmlSerialization
}
}
#endif
+
+ public class Bug594490Class
+ {
+ [XmlAttribute ("xml:lang")]
+ public string GroupName;
+ }
+
+ [Test]
+ public void Bug594490_SerializationOfXmlLangAttribute ()
+ {
+ var serializer = new XmlSerializer (typeof(Bug594490Class));
+
+ using (var writer = new StringWriter ()) {
+ var obj = new Bug594490Class ();
+
+ obj.GroupName = "hello world";
+
+ serializer.Serialize (writer, obj);
+ writer.Close ();
+
+ Assert.AreEqual (@"<?xml version=""1.0"" encoding=""utf-16""?>
+<Bug594490Class xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xml:lang=""hello world"" />",
+ writer.ToString (),
+ "Novell bug #594490 (https://bugzilla.novell.com/show_bug.cgi?id=594490) not fixed.");
+ }
+ }
}
}