469,950 Members | 1,432 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Cleaning up XML nodes before binding to a datagrid (C#)

Hello, I am trying to add a script to a website to clean up XML elements based on their values (please see code snippet below). My ASP page no longer loads attempting to add the following code. Any help would be very much appreciated.


<script runat="server">

private DataSet CleanUp(){
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("eventlog.xml"));

XmlNodeList nodeList = doc.SelectNodes("//event");

strNow = (System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt"));
strResolve = strNow.AddDays(-1);
strDelete = strNow.AddDays(-5);

foreach (XmlNode node in nodeList) {
if (node.["status"].Value <> "Sticky" && node.["timestamp"].Value < strResolve ||
node.["status"].Value && <> "Resolved" && node.["timestamp"].Value < strResolve) {
node.["status"].Value = "Resolved";
}

if (node.["status"].Value = "Resolved" && node.["timestamp"].Value < strDelete) {
XmlNode parentNode;
parentNode = items.ParentNode;
parentNode.RemoveChild(items)
}
}
}
Feb 14 '07 #1
1 2328
I still haven't found my solution... I'll post one for other readers though when I do.
Feb 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Brad Shook | last post: by
6 posts views Thread by p.mc | last post: by
3 posts views Thread by no | last post: by
11 posts views Thread by JoeC | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.