1
Reply

read file using xmlreader and xpath

Priya Pated

Priya Pated

Feb 16 2011 8:27 AM
7.4k

I am reading a XML file ,

XmlDocument objectTemporaryDocument = new XmlDocument();

objectTemporaryDocument.Load(

stringPathOfFile);

XmlNodeList objContentXmlNode = objectContentDocument.SelectNodes("/Root/Section");
foreach (XmlNode objInternalPages in objContentXmlNode)
{
XmlNode xmlNodeSettings = objInternalPages.SelectSingleNode("SubSection");
if (xmlNodeSettings != null)
{
stringModuleOverviewAlignment = xmlNodeSettings.Attributes["AttributeVal1"].Value;
stringGlobalDate = xmlNodeSettings.Attributes["AttributeVal2"].Value;
}
}

Which is giving required values and results..,But xml document is very big in size
so taking more time.

Can anyone tell me how to achive this using XPATH and XmlReader

thanks in advance
Priya

Answers (1)