コード例 #1
0
        /// <summary>
        /// This should be a part of the I/O layer
        /// </summary>
        /// <param name="inputUri">This could be a file or a url</param>
        public static XElement Load(string inputUri)
        {
            XElement element;

            using (Stream stream = UriResolver.GetStream(inputUri))
            {
                element = XElement.Load(stream);
            }

            return(element);
        }
コード例 #2
0
        /// <summary>
        /// This should be a part of the I/O layer
        /// </summary>
        /// <param name="loadOptions">Load options.</param>
        /// <param name="inputUri">This could be a file or a url</param>
        public static XDocument Load(string inputUri, LoadOptions loadOptions)
        {
            if (inputUri.Contains("://"))
            {
                using (Stream stream = UriResolver.GetStream(inputUri))
                {
                    return(XDocument.Load(stream, loadOptions));
                }
            }

            return(XDocument.Load(inputUri, loadOptions));
        }