try to work around missing BOM
parent
e308ab8843
commit
aca5728ab2
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
|||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
@ -129,9 +130,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
try
|
||||
{
|
||||
// Quickly check if this is a coalesced object, without fully parsing the XML
|
||||
using (StringReader sr = new StringReader(xml))
|
||||
{
|
||||
using (XmlTextReader reader = new XmlTextReader(sr))
|
||||
using (XmlTextReader reader = new XmlTextReader(new StringReader(xml)))
|
||||
{
|
||||
reader.MoveToContent(); // skip possible xml declaration
|
||||
|
||||
|
@ -144,7 +143,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(xml);
|
||||
|
@ -199,9 +197,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
if (data[len - 1] == 0)
|
||||
--len;
|
||||
// Quickly check if this is a coalesced object, without fully parsing the XML
|
||||
using (MemoryStream ms = new MemoryStream(data, 0, len, false))
|
||||
{
|
||||
using (XmlTextReader reader = new XmlTextReader(ms))
|
||||
MemoryStream ms = new MemoryStream(data, 0, len, false);
|
||||
StreamReader sr = new StreamReader(ms, Encoding.UTF8);
|
||||
using (XmlTextReader reader = new XmlTextReader(sr))
|
||||
{
|
||||
reader.MoveToContent(); // skip possible xml declaration
|
||||
|
||||
|
@ -211,9 +209,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
}
|
||||
}
|
||||
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
XmlDocument doc = new XmlDocument();
|
||||
using (ms = new MemoryStream(data, 0, len, false))
|
||||
doc.Load(ms);
|
||||
|
||||
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
|
||||
if (e == null)
|
||||
return false;
|
||||
|
@ -242,7 +241,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of binary xml failed ", e);
|
||||
|
|
|
@ -29,8 +29,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
@ -86,7 +86,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
return null;
|
||||
if(data[len -1 ] == 0)
|
||||
--len;
|
||||
using (MemoryStream ms = new MemoryStream(data,0, len, false))
|
||||
|
||||
MemoryStream ms = new MemoryStream(data,0, len, false);
|
||||
using(StreamReader sr = new StreamReader(ms, Encoding.UTF8))
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(ms, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
|
||||
{
|
||||
|
@ -97,7 +99,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[SERIALIZER]: Deserialization of xml data failed ", e);
|
||||
string s = Utils.BytesToString(data);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue