<PackageReference Include="Relativity.Server.Utility.SDK" Version="5000.0.0" />

XmlHelper

public class XmlHelper
Provides static methods for generating audit elements as well as XML serialization/deserialization.
public XmlHelper()

public static T Deserialize<T>(string input)

Deserializes the provided string.

public static Dictionary<string, string> DeserializeToDictionary(string input)

Deserializes the provided input into a dictionary of field value pairs made from the node names and the node contents. The input must be XML formatted and contain a single node with a single-level of unique XML nodes. For example: <data> <field1>value</field1> <field2>value2</field2> </data>

public static string GenerateAuditElement(string name, IDictionary values)

Generates the XML for an audit elemen

public static string GenerateAuditElement(string name, string subElementTag, IDictionary values)

Generates the XML for an audit element.

public static string GenerateAuditElement(string auditMessage)

Creates a string representing an audit element with a corresponding audit message

public static string GenerateCollectionAwareAuditElement(string name, string subElementTag, IDictionary values)

Generates a collection aware audit element.

public static string GetInnerXml(XDocument xDoc)

Reads all of the content from the provided document.

public static XmlDocument LoadUntrustedStream(Stream stream)

Loads a stream from an untrusted source and returns an XmlDocument. Protects against XML Bombs.

public static XmlDocument LoadUntrustedString(string input)

Loads a string from an untrusted source and returns an XmlDocument. Protects against XML Bombs.

public static string ScrubInvalidXmlStrings(string dirtyString, string replacement = "")

Replaces strings that represent invalid XML characters from the input string with the replacement string Will remove hex and decimal version, and is not case sensitive. All values below will be removed when preceeded by "ampersand pound" and followed by "semicolon" Hex: 0x00-0x08, 0x0B-0x1F, x7F, 0xFFFE-0xFFFF Decimal: 0-8, 11-31, 127, 65534-65535

public static string Serialize<T>(T obj)

Serializes the provided object.

public static string Serialize<T>(T obj, bool includeNamespaceInfo)

Serializes the provided object.

public static string Serialize<T>(T obj, bool includeNamespaceInfo, bool omitXMLDeclaration)

Serializes the provided object.

public static string SerializeDictionaryToXML(Dictionary<string, string> input)

Serializes the provided input dictionary into an XML formatted string.

public static string StripIllegalXmlCharacters(string textInput, string replacement = null)

Removes characters from a string that are absolutely not allowed in the XML specification, such as system characters. It will not remove or escape characters that require being escaped.