TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mark Maguire
NA
17
17.8k
XMLTextReader - Pass to XDocument.Load and interact
Mar 3 2011 9:29 AM
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.
Reply
Answers (
7
)
Gridview fixed header problem
How to use SSRS in visual studio 2010