I am attempting to parse through an XML document using the XmlDocument
object. I keep getting a NullReferenceEx ception. I have even tried using
the fully qualified name, but with no luck. Here is the code:
private void Page_Load(objec t sender, System.EventArg s e)
{
StringBuilder sb = new StringBuilder() ;
System.Xml.XmlD ocument xd = new System.Xml.XmlD ocument();
xd.Load(Server. MapPath("lib/schoolAnnouncem ents.xml"));
XmlNode nd;
nd = xd.FirstChild["counties"];
foreach(System. Xml.XmlNode n in nd.ChildNodes)
{
if(n.Name=="cou nty")
sb.Append(Strin g.Format("{0}<b r>",n.InnerText ));
}
elems=sb.ToStri ng();
}
Any suggestions?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
object. I keep getting a NullReferenceEx ception. I have even tried using
the fully qualified name, but with no luck. Here is the code:
private void Page_Load(objec t sender, System.EventArg s e)
{
StringBuilder sb = new StringBuilder() ;
System.Xml.XmlD ocument xd = new System.Xml.XmlD ocument();
xd.Load(Server. MapPath("lib/schoolAnnouncem ents.xml"));
XmlNode nd;
nd = xd.FirstChild["counties"];
foreach(System. Xml.XmlNode n in nd.ChildNodes)
{
if(n.Name=="cou nty")
sb.Append(Strin g.Format("{0}<b r>",n.InnerText ));
}
elems=sb.ToStri ng();
}
Any suggestions?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Comment