diff options
author | Robert Adams | 2017-06-08 21:41:34 -0700 |
---|---|---|
committer | Robert Adams | 2017-06-08 21:41:34 -0700 |
commit | 5bfe8b18fe47012530231a614c9123372afb4c03 (patch) | |
tree | 7adf1439aabeba09ada9678b3c6b5e7f1965e9c6 /OpenSim | |
parent | bug fix plus some cleanup (diff) | |
download | opensim-SC_OLD-5bfe8b18fe47012530231a614c9123372afb4c03.zip opensim-SC_OLD-5bfe8b18fe47012530231a614c9123372afb4c03.tar.gz opensim-SC_OLD-5bfe8b18fe47012530231a614c9123372afb4c03.tar.bz2 opensim-SC_OLD-5bfe8b18fe47012530231a614c9123372afb4c03.tar.xz |
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.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 892403b..aa15422 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -1361,7 +1361,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1361 | 1361 | ||
1362 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) | 1362 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) |
1363 | { | 1363 | { |
1364 | string value = reader.ReadElementContentAsString("Media", String.Empty); | 1364 | string value = String.Empty; |
1365 | try | ||
1366 | { | ||
1367 | // The prominant format for MOAP is escaped XML (with > etc). | ||
1368 | // This is read as a string and passed to PrimitiveBaseShape which requires | ||
1369 | // its XML as a string (which it parses with its own XmlReader). | ||
1370 | value = reader.ReadElementContentAsString("Media", String.Empty); | ||
1371 | } | ||
1372 | catch (XmlException e) | ||
1373 | { | ||
1374 | // There are versions of OAR files that contain unquoted XML. | ||
1375 | try | ||
1376 | { | ||
1377 | m_log.WarnFormat("[SERIALIZER] MOAP specification in non-escaped XML format. Recovering."); | ||
1378 | value = reader.ReadInnerXml(); | ||
1379 | } | ||
1380 | catch (Exception ee) | ||
1381 | { | ||
1382 | m_log.ErrorFormat("[SERIALIZER] Failed parsing of MOAP information"); | ||
1383 | throw new XmlException("Failed parsing of MOAP media XML element"); | ||
1384 | } | ||
1385 | } | ||
1365 | shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); | 1386 | shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); |
1366 | } | 1387 | } |
1367 | 1388 | ||