473,804 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete filtered xml element

41 New Member
Hi
I am trying to delete filtered Xml element from xml file with date following is the code but its not woking.
Plz help me.



XmlDocument doc = new XmlDocument();
doc.Load(filena me);

XmlNodeList nodeList;
XmlNode root = doc.DocumentEle ment;

nodeList = root.SelectNode s("/XmlError/Error[Time > '4/2/2008 2:17:38 PM']");

//Change the price on the books.
foreach (XmlNode xmlErrNode in nodeList)
{
root.RemoveChil d(xmlErrNode);

}

doc.Save(filena me);



*************** ****** xml file is as *************** *************** ******
<XmlError>
<Error>
<id>1</id>
<Time>4/1/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>3</id>
<Time>4/3/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>4</id>
<Time>4/4/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>5</id>
<Time>4/5/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>5</id>
<Time>4/6/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>5</id>
<Time>4/7/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>5</id>
<Time>3/5/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>5</id>
<Time>3/6/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>5</id>
<Time>3/7/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
<Error>
<id>5</id>
<Time>3/8/2008 2:17:38 PM</Time>
<ErrorMessage>C ould not find file 'd:\rahul\proje cts\consolapp\d ownloadbloomber gdata\prjguicom pexteltupdate\x mlErrorLog.xml' .</ErrorMessage>
</Error>
</XmlError>
Apr 4 '08 #1
0 692

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

Similar topics

3
10074
by: richardkreidl | last post by:
I have the following module that I delete old files based on how old they are: Sub Main() Dim First_Date As String = Date.Today.AddDays(-7) Dim Archive_Files() As String = System.IO.Directory.GetFiles("C:\Turnover") Dim Filtered As New ArrayList For x As Integer = 0 To Archive_Files.Length - 1 If File.GetLastWriteTime(Archive_Files(x)) < First_Date
0
978
by: gouraud | last post by:
Hello, I'm working on Visual Web Developper (ASPX with C# code Behind) I would like to fill a DataList with items using this format (with as item as elements) : "file - element", example : "MyTitle - Theme A" The problem is that labels, which are binded to theses fields, return me an error :
6
6433
by: flash | last post by:
write a program that manipulates arrays of integers. The main program should call three functions: Insert, Delete, and Search. The Insert function should call a function Sort that sorts the array. Here is a description of the three functions: Insert: Accepts as input the array and the element you want to insert into the array. The function should insert the element at the end of the array and should call the function Sort to sort the...
8
1717
by: Ratko | last post by:
Say you have something like this: for item in myList: del item Would this actually delete the item from the list or just decrement the reference counter because the item in myList is not associated with name "item" anymore (but still is with myList)? In other words, is "item" a temporary reference to myList or is it actually that reference that myList has stored?
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10603
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10356
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.