472,090 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,090 software developers and data experts.

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 2352
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 Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.