Use linq2xml..Its simple to use..
XElement doc=XElement.Load("yourXml.xml");
XNamespace ns="http://www.developer.cognos.com/schemas/bmt/60/1";
m_pnalList=doc.Descendants(ns+"package")
.Select(d=>
new PackageNameAndLocation
{
PackageName=(string)d.Element(ns+"name"),
LastLocation=(string)d.Element(ns+"lastPublishedCMPath")
}
)
.ToList<PackageNameAndLocation>();
If you want to stick with xmldocument!
1>You don't need the methods in PackageNameAndLocation..Just keep the properties
2>this should do
XmlNodeList m_package = xmlDoc.DocumentElement.SelectNodes("//cg:package", Configuration.Instance.NSManager);
string m_lastLocation = string.Empty;
foreach (XmlNode package in m_package)
{
PackageNameAndLocation m_pnalClass = new PackageNameAndLocation();
m_pnalClass.PackageName = package.SelectSingleNode("//cg:name").InnerText;
XmlNode m_lastPublishedCMPath = name.SelectSingleNode("//cg:lastPublishedCMPath", Configuration.Instance.NSManager);
.....