aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-09 15:51:02 +0000
committerJustin Clarke Casey2008-05-09 15:51:02 +0000
commit6e2c7da0182c0ee5bf95cb50e95878caa968a77b (patch)
tree8c7699c47ad20bed5b2e0ead2cd25797b5b52ce9 /OpenSim/Framework/Util.cs
parent* Restoring some initial inventory lookup polling delays in order to deal wit... (diff)
downloadopensim-SC-6e2c7da0182c0ee5bf95cb50e95878caa968a77b.zip
opensim-SC-6e2c7da0182c0ee5bf95cb50e95878caa968a77b.tar.gz
opensim-SC-6e2c7da0182c0ee5bf95cb50e95878caa968a77b.tar.bz2
opensim-SC-6e2c7da0182c0ee5bf95cb50e95878caa968a77b.tar.xz
* Minor: Insert utility function to format raw xml strings into indented xml for debugging purposes
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs36
1 files changed, 35 insertions, 1 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 0943626..5577140 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -36,6 +36,7 @@ using System.Runtime.Serialization.Formatters.Binary;
36using System.Security.Cryptography; 36using System.Security.Cryptography;
37using System.Text; 37using System.Text;
38using System.Text.RegularExpressions; 38using System.Text.RegularExpressions;
39using System.Xml;
39using libsecondlife; 40using libsecondlife;
40using log4net; 41using log4net;
41using Nini.Config; 42using Nini.Config;
@@ -43,6 +44,9 @@ using Nwc.XmlRpc;
43 44
44namespace OpenSim.Framework 45namespace OpenSim.Framework
45{ 46{
47 /// <summary>
48 /// Miscellaneous utility functions
49 /// </summary>
46 public class Util 50 public class Util
47 { 51 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -161,6 +165,36 @@ namespace OpenSim.Framework
161 // (but those probably wont work anyway) 165 // (but those probably wont work anyway)
162 return file; 166 return file;
163 } 167 }
168
169 /// <summary>
170 /// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes.
171 ///
172 /// Please don't delete me even if I appear currently unused!
173 /// </summary>
174 /// <param name="rawXml"></param>
175 /// <returns></returns>
176 public static string GetFormattedXml(string rawXml)
177 {
178 XmlDocument xd = new XmlDocument();
179 xd.LoadXml(rawXml);
180
181 StringBuilder sb = new StringBuilder();
182 StringWriter sw = new StringWriter(sb);
183
184 XmlTextWriter xtw = new XmlTextWriter(sw);
185 xtw.Formatting = Formatting.Indented;
186
187 try
188 {
189 xd.WriteTo(xtw);
190 }
191 finally
192 {
193 xtw.Close();
194 }
195
196 return sb.ToString();
197 }
164 198
165 public static bool IsEnvironmentSupported(ref string reason) 199 public static bool IsEnvironmentSupported(ref string reason)
166 { 200 {
@@ -634,4 +668,4 @@ namespace OpenSim.Framework
634 return client.Send(url, 6000); 668 return client.Send(url, 6000);
635 } 669 }
636 } 670 }
637} \ No newline at end of file 671}