Exemplo n.º 1
0
        private void ConstructFromXml(string dataSourcesXml, bool clientLoad, IDataProtection dataProtection)
        {
            XmlDocument xmlDocument = new XmlDocument();

            try
            {
                XmlUtil.SafeOpenXmlDocumentString(xmlDocument, dataSourcesXml);
            }
            catch (XmlException ex)
            {
                throw new MalformedXmlException(ex);
            }
            try
            {
                XmlNode xmlNode = xmlDocument.SelectSingleNode("/DataSources");
                if (xmlNode == null)
                {
                    throw new InvalidXmlException();
                }
                foreach (XmlNode childNode in xmlNode.ChildNodes)
                {
                    DataSourceInfo dataSource = DataSourceInfo.ParseDataSourceNode(childNode, clientLoad, dataProtection);
                    this.Add(dataSource);
                }
            }
            catch (XmlException)
            {
                throw new InvalidXmlException();
            }
        }
Exemplo n.º 2
0
 public static DataSourceInfo ParseDataSourceNode(XmlNode node, bool clientLoad, IDataProtection dataProtection)
 {
     return(DataSourceInfo.ParseDataSourceNode(node, clientLoad, false, dataProtection));
 }