473,662 Members | 2,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Small program to manipulate this XML? how??

Ron
I would like to write a small program to manipulate this XML:

http://www.keepitsimplekid.com/xml/Ad00304.xml

What I want the program to do.

it would look at all.xml documents in a directory for example
directory C:\XML\rename

A Rename button would be pressed on the form and the program would go
through all the XML documents, first rename the documents from
FILENAME.XML to FIRNAME.XML.BAK - I still want to keep the
FILENAME.XML document, because that is the one the manipulation will
take place on.

I then want to look at each .xml document and REPLACE the Untitled Ad
text on the fourth line with whatever is here:

- <Application_In fo AI_TYPE="ETS_AD VERTISER">
<Ai_Item NAME="LEAF GUARD" />

So <Meta NAME="Untitled Ad" <--- that Untitled Ad text would now
become:

<Meta NAME="LEAF GUARD"

I then want to save the file. So the directory will now contain the
old file with Untitled Ad in it as the filename.xml.ba k and then the
converted file as .xml

Also, there will be more than 1 xml doc in that directory, so this
needs to go through each one, rename and manipulate them.

how would I do this? I have no Idea how to even begin this.

May 5 '07 #1
1 1172
Ron <pt*****@yahoo. comwrote in news:1178393233 .389672.298540
@y5g2000hsa.goo glegroups.com:
how would I do this? I have no Idea how to even begin this.

You have a couple ways to loading up the document and finding the
particular field to change. In the System.XML namespace you can use an
XMLReader or the XMLDocument classes. XMLReader is forward only and allows
you to loop through the document. XMLDocument loads the entire document in
a DOM and you can navigate directly to the location with an XPATH query.

I personally like using XPATH - it's very powerful and allows you to
perform queries, etc on the document. However if the document is not suited
to be queried (i.e. each doc is slightly different), perhaps consider
looping through all the elements and parse out the attributes
appropriately.
May 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1408
by: Yannick | last post by:
Hey everybody, Do you know if ASP can change a JPG file in a smaller defined size JPG. Do you have an exemple of it. Imagine the JPG is on the C: drive of my server and called PIC.JPG. Thanks in advance. Yannick
29
3930
by: steve | last post by:
Hi, Recently I have been looking at the various ways people are implementing, interaction between java & oracle databases. I was always instructed on the purity of the data model, "normalize the data" etc. I have seen people Serializing java objects , such as purchase orders orders, customer records etc , then sticking the "object" into am oracle blob
1
2698
by: Chris | last post by:
Hi, how do I develop the following 'simple' program using ASP.NET webforms : a client has a text-file (aaa.txt) that has to be manipulated by code located on the server, the server would then manipulate the content and send the manipulated content back to the client, where the client saves it to (bbb.txt) What scenario would be best :
32
5641
by: David Isaac | last post by:
I have no experience with database applications. This database will likely hold only a few hundred items, including both textfiles and binary files. I would like a pure Python solution to the extent reasonable. Suggestions? Thank you, Alan Isaac
4
3660
by: ATS16805 | last post by:
Hi. I wonder if it's possible to "force" a browser to "switch to SSR mode" for any given document. Specifically, I'm looking for a solution, not to a User Agent issue (i think), but a coding idea; a programming "what if..?". i'm not concerned w/ manipulating a browser (i.e. prefs., settings this URL, always view SSR, save), but rather something i would code into the document which would request the browser to display in this mode (i.e....
1
2025
by: Robert | last post by:
If the goal is to take a 1-dimensional package of text and produce a tree data structure that is easy to understand and manipulate, and then write C/C++ code that works with that tree - does lex/yacc suit that purpose - i.e. kind of like a tree-manufacturing C library? Or is it for producing a compiler/interpreter the internals of which a new C/ C++ program cannot so easily work with?
1
27083
Curtis Rutland
by: Curtis Rutland | last post by:
How To Use A Database In Your Program Part II This article is intended to extend Frinny’s excellent article: How to Use a Database in Your Program. Frinny’s article defines the basic concepts of using databases very well and is prerequisite reading for this article. Frinny’s article explains how to use a SQL Server in your program, but there are other databases as well. Some of them provide .NET connectors, but for those that don’t,...
1
1763
by: not_a_commie | last post by:
Here are a few thoughts for loading and storing your xml using the XmlDocument class: First, don't ever insert the header manually. This is to be done by the writer. In other words, don't do this: document.AppendChild(document.CreateXmlDeclaration("1.0", "UTF-8", null)); If you do that and then write your document to a stream with an
0
8435
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
8857
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...
1
8547
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,...
1
6186
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
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
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
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.