예제 #1
0
        public static TObjectType FromXml <TObjectType>(string strXml)
            where TObjectType : IXmlConvertible, new()
        {
            if (strXml == null)
            {
                throw new ArgumentNullException("strXml", "A valid non-null string is required.");
            }

            XmlLiteDocument objXmlLiteDocument = null;

            try
            {
                objXmlLiteDocument = XmlLiteDocument.LoadFromXml(strXml);
            }
            catch (Exception objException)
            {
                string strErrorMessage = "Unable to load the XML fragment:\n" + strXml;
                throw new Exception(strErrorMessage, objException);
            }

            return(FromXml <TObjectType>(objXmlLiteDocument));
        }