CSharp examples for System.Xml:XML Document
Get Config As Xml Document
using System.Xml.Linq; using System.Linq; using System.Reflection; using System.Security.Permissions; using System.IO;//from w w w .ja v a 2s . c o m using System.Collections; using System.Xml; using System.Text; using System.Collections.Generic; using System; public class Main{ public static XmlDocument GetConfigAsXmlDocument(Stream resourceStream) { XmlDocument document = new XmlDocument(); XmlTextReader reader = null; try { reader = new XmlTextReader(resourceStream); document.Load(reader); } catch (Exception exception) { // } finally { if (reader != null) { reader.Close(); } } return document; } public static XmlDocument GetConfigAsXmlDocument(string resourcePath) { XmlDocument document = new XmlDocument(); XmlTextReader reader = null; try { reader = new XmlTextReader(resourcePath); document.Load(reader); } catch (Exception exception) { // } finally { if (reader != null) { reader.Close(); } } return document; } }