diff options
author | Justin Clark-Casey (justincc) | 2014-08-29 19:08:23 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-29 19:08:23 +0100 |
commit | 1b75ec5647afeb9fbdad78f70c0c90a829bba076 (patch) | |
tree | 500744dddfc3f4238391d9e04ca431669f742ce5 /OpenSim/Framework/Util.cs | |
parent | Fix recent regression test TestDeserializeXmlObjectWithOtherParts() which was... (diff) | |
download | opensim-SC-1b75ec5647afeb9fbdad78f70c0c90a829bba076.zip opensim-SC-1b75ec5647afeb9fbdad78f70c0c90a829bba076.tar.gz opensim-SC-1b75ec5647afeb9fbdad78f70c0c90a829bba076.tar.bz2 opensim-SC-1b75ec5647afeb9fbdad78f70c0c90a829bba076.tar.xz |
Ignore whitespace when reading serialized XML objects.
This was previously effectively being done by XmlDocument in the multiple passes through the XML.
This change tells XmlReader to ignore whitespace. This also means changing arguments to use XmlReader instead of XmlTextReader (a descendent of XmlReader) directly.
XmlReader.Create() has been the recommend way to create XML readers since .NET 2.0 as per MS SDK and is the only way to specific ignore whitespace settings.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 2d0178e..2c38571 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -2605,7 +2605,7 @@ namespace OpenSim.Framework | |||
2605 | } | 2605 | } |
2606 | 2606 | ||
2607 | #region Xml Serialization Utilities | 2607 | #region Xml Serialization Utilities |
2608 | public static bool ReadBoolean(XmlTextReader reader) | 2608 | public static bool ReadBoolean(XmlReader reader) |
2609 | { | 2609 | { |
2610 | // AuroraSim uses "int" for some fields that are boolean in OpenSim, e.g. "PassCollisions". Don't fail because of this. | 2610 | // AuroraSim uses "int" for some fields that are boolean in OpenSim, e.g. "PassCollisions". Don't fail because of this. |
2611 | reader.ReadStartElement(); | 2611 | reader.ReadStartElement(); |
@@ -2616,7 +2616,7 @@ namespace OpenSim.Framework | |||
2616 | return result; | 2616 | return result; |
2617 | } | 2617 | } |
2618 | 2618 | ||
2619 | public static UUID ReadUUID(XmlTextReader reader, string name) | 2619 | public static UUID ReadUUID(XmlReader reader, string name) |
2620 | { | 2620 | { |
2621 | UUID id; | 2621 | UUID id; |
2622 | string idStr; | 2622 | string idStr; |
@@ -2635,7 +2635,7 @@ namespace OpenSim.Framework | |||
2635 | return id; | 2635 | return id; |
2636 | } | 2636 | } |
2637 | 2637 | ||
2638 | public static Vector3 ReadVector(XmlTextReader reader, string name) | 2638 | public static Vector3 ReadVector(XmlReader reader, string name) |
2639 | { | 2639 | { |
2640 | Vector3 vec; | 2640 | Vector3 vec; |
2641 | 2641 | ||
@@ -2648,7 +2648,7 @@ namespace OpenSim.Framework | |||
2648 | return vec; | 2648 | return vec; |
2649 | } | 2649 | } |
2650 | 2650 | ||
2651 | public static Quaternion ReadQuaternion(XmlTextReader reader, string name) | 2651 | public static Quaternion ReadQuaternion(XmlReader reader, string name) |
2652 | { | 2652 | { |
2653 | Quaternion quat = new Quaternion(); | 2653 | Quaternion quat = new Quaternion(); |
2654 | 2654 | ||
@@ -2677,7 +2677,7 @@ namespace OpenSim.Framework | |||
2677 | return quat; | 2677 | return quat; |
2678 | } | 2678 | } |
2679 | 2679 | ||
2680 | public static T ReadEnum<T>(XmlTextReader reader, string name) | 2680 | public static T ReadEnum<T>(XmlReader reader, string name) |
2681 | { | 2681 | { |
2682 | string value = reader.ReadElementContentAsString(name, String.Empty); | 2682 | string value = reader.ReadElementContentAsString(name, String.Empty); |
2683 | // !!!!! to deal with flags without commas | 2683 | // !!!!! to deal with flags without commas |