src/XML parser/XmlParser.cs
/// <summary>
/// Parse a message from appropriate xml-like string
/// </summary>
/// <param name="xml">String representation of the message in utf-8</param>
/// <returns>Message object parsed from the string</returns>
Parse a message from appropriate xml-like string
Parse a message from appropriate xml - like string
public static message Parse(string xml)
    {
        MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(xml));
        XmlSerializer serializer = new XmlSerializer(typeof(message));
        XmlReader reader = XmlReader.Create(new StreamReader(stream, Encoding.UTF8));
        message mes = (message)serializer.Deserialize(reader);
        if (!(Validate(mes)))
            throw (new PolicyException("Message does not follow the protocol"));
        return mes;
    }
public static message Parse ( string xml ) { MemoryStream stream = new MemoryStream ( Encoding . UTF8 . GetBytes ( xml ) ) ; XmlSerializer serializer = new XmlSerializer ( typeof ( message ) ) ; XmlReader reader = XmlReader . Create ( new StreamReader ( stream , Encoding . UTF8 ) ) ; message mes = ( message ) serializer . Deserialize ( reader ) ; if ( ! ( Validate ( mes ) ) ) throw ( new PolicyException ( " " ) ) ; return mes ; }
Parse a message from appropriate xml-like string
Parse a message from appropriate xml - like string
Message object parsed from the string
Message object parsed from the string
xml
string
String representation of the message in utf-8
String representation of the message in utf - 8