mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
Another attempt at parsing MOAP <Media> elements in OAR files.
Seems there are multiple interpretations of the format of the content of the <Media> element in OAR files. OpenSimulator (for reasons lost in the mist of time) escapes the XML in the element and then reparses it was a separate XmlReader. Other simulators fill the <Media> element with regular XML. This patch parses the <Media> escaped XML content as it always has and, if the parsing fails, falls back to trying to parse the pure XML.
This commit is contained in:
@@ -1361,7 +1361,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader)
|
||||
{
|
||||
string value = reader.ReadElementContentAsString("Media", String.Empty);
|
||||
string value = String.Empty;
|
||||
try
|
||||
{
|
||||
// The prominant format for MOAP is escaped XML (with > etc).
|
||||
// This is read as a string and passed to PrimitiveBaseShape which requires
|
||||
// its XML as a string (which it parses with its own XmlReader).
|
||||
value = reader.ReadElementContentAsString("Media", String.Empty);
|
||||
}
|
||||
catch (XmlException e)
|
||||
{
|
||||
// There are versions of OAR files that contain unquoted XML.
|
||||
try
|
||||
{
|
||||
m_log.WarnFormat("[SERIALIZER] MOAP specification in non-escaped XML format. Recovering.");
|
||||
value = reader.ReadInnerXml();
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
m_log.ErrorFormat("[SERIALIZER] Failed parsing of MOAP information");
|
||||
throw new XmlException("Failed parsing of MOAP media XML element");
|
||||
}
|
||||
}
|
||||
shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user