473,385 Members | 1,402 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,385 software developers and data experts.

Read, modify & save xml file

Hi,

Using Python, I want to read xml file from the disk, modify the values/add elements/attributes and save the xml back to disk.

Please give me the sample source code for the same.

Thanks,
Jun 9 '08 #1
2 6662
You can make use of the the xml.dom or xml.dom.minidom to parse the xml files. If not successful try simple search and replace methods using file objects
Jun 10 '08 #2
Laharl
849 Expert 512MB
Use minidom rather than dom, it's much more lightweight.
Jun 10 '08 #3

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

Similar topics

6
by: Sara Khalatbari | last post by:
Dear friends In a code, I'm opening a file to read. Like : lines = open(filename).readlines() & I'm never closing it. I'm not writing in that file, I just read it. Will it cause any problems...
7
by: Graham Taylor | last post by:
I've tried posting this in the 'microsoft.public.access' but I will post it here also, as I think it might be the webserver which is causing my problem. --------- I have an Access 2003 database...
8
by: Arvind P Rangan | last post by:
Hi, i like to read an existing xml file which has a schema defined to it, and then write or add data to the existing xml file using vb.net/c#. May be this Question has been answered earlier....
0
by: Patrick De Ridder | last post by:
Below an example from "Windows Forms Programming with C#", by Erik Brown (Manning) p. 228. According to me the example is wrong. The message box does not get activated when an erroneous file name...
6
by: Phoebe. | last post by:
Hi, Good Day! How can I read data from excel file and save them into a recordset? Can someone help? Thanks in advanced. rgds, Phoebe.
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as & to be valid. I don't have Firefox my self and don't wont to install it only...
2
by: sani8888 | last post by:
Hi everybody I am a beginner with C++ programming. And I need some help. How can I start with this program *********** The program is using a text file of information as the source of the...
2
by: =?Utf-8?B?YW5rMmdv?= | last post by:
Thanks in advance for reading this. Let's say I have a file (file01) with this data in ASCII (ignore line col): line01 123abc line02 Header01 Starts blah var line03 detail01 000001...
0
by: student491 | last post by:
hello, I opened the excel file by using workbook.open() method... Now i want to read the data from the excel file.. & save it into array. help out .. how to do this. Then i want to pass...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...

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.