src/XML parser/XmlParser.cs
/// <summary>
/// Deparse a message to an XML string
/// </summary>
/// <param name="mes">Message to be deparsed</param>
/// <returns>String representation of deparsed message</returns>
Deparse a message to an XML string
Deparse a message to an XML string
public static string Deparse(message mes)
    {
        if (!(Validate(mes)))
            throw (new PolicyException("Message does not follow the protocol"));
        XmlSerializer serializer = new XmlSerializer(typeof(message));
        MemoryStream stream = new MemoryStream();
        XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();
        xsn.Add(String.Empty, String.Empty);
        XmlTextWriter sw = new XmlTextWriter(stream, Encoding.UTF8);
        serializer.Serialize(sw, mes, xsn);
        return Encoding.UTF8.GetString(stream.ToArray()).Substring(1);
    }
public static string Deparse ( message mes ) { if ( ! ( Validate ( mes ) ) ) throw ( new PolicyException ( " " ) ) ; XmlSerializer serializer = new XmlSerializer ( typeof ( message ) ) ; MemoryStream stream = new MemoryStream ( ) ; XmlSerializerNamespaces xsn = new XmlSerializerNamespaces ( ) ; xsn . Add ( String . Empty , String . Empty ) ; XmlTextWriter sw = new XmlTextWriter ( stream , Encoding . UTF8 ) ; serializer . Serialize ( sw , mes , xsn ) ; return Encoding . UTF8 . GetString ( stream . ToArray ( ) ) . Substring ( 1 ) ; }
Deparse a message to an XML string
Deparse a message to an XML string
String representation of deparsed message
String representation of deparsed message
mes
message
Message to be deparsed
Message to be deparsed