/// <summary> /// Initializes a new instance of the <see cref="XmlObjectStream" /> class. /// </summary> /// <param name="stream">Base stream to use for reading and writing objects.</param> /// <param name="xmlRootTag">Name of the XML root tag of every object message.</param> /// <param name="traceDescription">The WWI trace description.</param> /// <param name="traceEndPoint">The WWI trace endpoint.</param> public XmlObjectStream(Stream stream, string xmlRootTag, string traceDescription = null, string traceEndPoint = null) { if (stream == null) { throw new ArgumentException("Invalid stream specified."); } if (string.IsNullOrEmpty(xmlRootTag)) { throw new ArgumentException("Invalid xmlRootTag specified."); } _xmlWriterSettings = new XmlWriterSettings(); _xmlWriterSettings.Encoding = new UTF8Encoding(false); _xmlWriterSettings.OmitXmlDeclaration = true; _xmlSerializerNamespaces = new XmlSerializerNamespaces(); _xmlSerializerNamespaces.Add(string.Empty, string.Empty); _messageObjectTypeRegex = new Regex(string.Format(MessageObjectTypeRegex, xmlRootTag), RegexOptions.Compiled | RegexOptions.IgnoreCase); _stream = new XmlMessageStream(stream, xmlRootTag, traceDescription, traceEndPoint); }