I am loading an XML file into an XDocument like so:
XDocument oXDocument = XDocument.Load(m_sFile);
I want to know if I pass the Load method of the XDocument an XmlTextReader object in the manner shown below, can I interact with the loading mechanism using the XmlTextReader as if I were to use the Read method of XmlTextReader in a conventional manner?
Conventional XmlTextReader use
-------------------------------
oReader = new XmlTextReader(m_sFile); while (oReader.Read()) { switch (oReader.NodeType) { case XmlNodeType.Element: //DO SOMETHING break; } }Passing the XmlTextReader
-------------------------
using (XmlTextReader oXMLTextReader = new XmlTextReader(m_sFile)) { oXMLTextReader.MoveToContent(); oXDocument = XDocument.Load(oXMLTextReader); }Any help is most welcome.