using System.Collections.Generic;
using System.Xml.Serialization;
using System.Diagnostics;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text.RegularExpressions;
using System.Globalization;
using System.ComponentModel.DataAnnotations;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
[XmlRoot("Root", Namespace = "")]
public string XmlStringValue { get { return _value; } set { _value = value; } }
[XmlElement("TextOutlTxt")]
return XElement.Parse(XmlStringValue);
XmlStringValue = (value == null ? null : value.ToString());
public static void Test()
var innerXml = "\x3Cp style=\"text-align:left;margin-top:0pt;margin-bottom:0pt;\"\x3E\n \x3Cspan\x3ESUBSTA SF6 CIRCUIT BKR CONC FDN \x26#x22;C\x26#x22;\x3C/span\x3E\n\x3C/p\x3E";
Console.WriteLine("Input XmlStringValue: ");
Console.WriteLine(innerXml);
var root = new Root { XmlStringValue = innerXml };
Console.WriteLine(string.Format("\nOutput {0}:", root));
public class AssertionFailedException : System.Exception
public AssertionFailedException() : base() { }
public AssertionFailedException(string s) : base(s) { }
public static class Assert
public static void IsTrue(bool value)
public static void IsTrue(bool value, string message)
throw new AssertionFailedException(message ?? "failed");
public static class XmlSerializationHelper
public static T LoadFromXml<T>(this string xmlString, XmlSerializer serial = null)
serial = serial ?? new XmlSerializer(typeof(T));
T returnValue = default(T);
using (StringReader reader = new StringReader(xmlString))
object result = serial.Deserialize(reader);
public static string GetXml<T>(this T obj, bool omitStandardNamespaces)
return obj.GetXml(null, omitStandardNamespaces);
public static string GetXml<T>(this T obj, XmlSerializer serializer = null, bool omitStandardNamespaces = false)
XmlSerializerNamespaces ns = null;
if (omitStandardNamespaces)
ns = new XmlSerializerNamespaces();
using (var textWriter = new StringWriter())
var settings = new XmlWriterSettings() { Indent = true };
using (var xmlWriter = XmlWriter.Create(textWriter, settings))
(serializer ?? new XmlSerializer(obj.GetType())).Serialize(xmlWriter, obj, ns);
return textWriter.ToString();
public static void Main()
Console.WriteLine("Environment version: " + Environment.Version);