473,394 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 2378
I still haven't found my solution... I'll post one for other readers though when I do.
Feb 20 '07 #2

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

Similar topics

0
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a...
0
by: Shane O. Pinnell | last post by:
I am sure this has come up before, but I haven't been able to find an answer as of yet. That said, any help is definitely appreciated! I have a datagrid populated from a dataset. I have a...
3
by: Jim Bancroft | last post by:
Hi everyone, I'm binding an ArrayList to a DataGrid for the first time (I'm used to binding DataSets and DataTables) and I was wondering if I could somehow "name" the ArrayList, so that I can...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
5
by: Brad Shook | last post by:
I am trying to bind one column of a datagrid to a seperate textbox and the rest of the fields to a datagrid. the comments are too large to fit in a datagrid so I created a textbox below the...
6
by: p.mc | last post by:
Hi all, I'm having major problems with a userControl which contains a datagrid. My problem concerns data binding. The Page_Load() procedure calls the DataBind procedure to bind the datagrid...
3
by: no | last post by:
Hi all, I have a dataset that contain 2 tables and a relationship between them (master detail). I bind this dataset to a form that include some textboxes that bind to the parent record, and a...
11
by: JoeC | last post by:
I have been using C++ for several years now and I have been reading about nodes. I am a little confused. I understand many of the concepts behind this such as pointers and dynamic binding. My...
1
by: Stephen Barrett | last post by:
I have an application that was originally built with ASP.Net 1.1. We finally got permission to migrate to 2.0. Due to time constraints we migrated the web projects to 2.0 web application...
1
by: Sasi Kumar | last post by:
I have a xml file. I want to display the nodes and childnodes in my datagrid, i used xmldatasource, but i can read a specific path only. The problem is i should not use dataset and xmldocument. Give...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.