Python Forum
parsing values and writing back in xml file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
parsing values and writing back in xml file
#1
Hi All,
I am attempting to parse the values from an xml file ,modify these vales and re-write the new values back into the xml file.
I have parsed the parameter values using libSBML.I wish to update the xml file with the new values of the parameter.
I couldn't find out how to write back the new values in xml file.

I would like to get some help to do this task.



Thanks again,
Deepa
Reply
#2
I'm confused.  If you've parsed the file, then you have an object that represents the xml file.  XML is just a text file.  So... does libsbml have write functionality?

There isn't really such a thing as "updating" a value in a file.  You either write the file, or you don't.  You aren't going to just write part of it.
Reply
#3
I have parsed only parameter values present in the file.
The following is a tag in my xml file,
<parameter id="G6PASE_Vmax" constant="true" value="18.9" units="mmol_per_s"/>
There are 30 such id's with a value corresponding to each.And I wish to change the value.
I have parsed the parameter id and the value using libsbml in python.Now, how do we write these new values back into the file?
Yes,libsbml has has write functionality.
I wish to obtain the xml file with new values against each parameter id.
Reply
#4
Could you provide a small example of the input file (3 lines would be plenty), along with how you're currently parsing it (again, 5 lines is probably all it'd take)?  That way it's easier to help (otherwise, I'm just guessing).
Reply
#5
Hi,
Please find the input file in the following link,
https://github.com/matthiaskoenig/glucos..._Model.xml

The python code is found in the following link,
https://github.com/DeepaMahm/cytoscape/b...r_parse.py

Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question [SOLVED] Linefeed when writing "f" strings to text file? Winfried 5 858 Nov-04-2025, 11:51 AM
Last Post: buran
  .xlsm file can't be opened after writing data to one worksheet mhyatt 4 885 Oct-11-2025, 11:25 PM
Last Post: Pedroski55
  Problems writing a large text file in python Vilius 4 2,033 Dec-21-2024, 09:20 AM
Last Post: Pedroski55
  writing list to csv file problem jacksfrustration 5 4,139 Jul-04-2024, 08:15 PM
Last Post: deanhystad
  Reading an ASCII text file and parsing data... oradba4u 2 2,898 Jun-08-2024, 12:41 AM
Last Post: oradba4u
  Capturing BS4 values into DF and writing to CSV cubangt 18 6,641 Sep-05-2023, 01:57 PM
Last Post: cubangt
Video doing data treatment on a file import-parsing a variable EmBeck87 15 7,985 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
  Read text file, modify it then write back Pavel_47 5 6,984 Feb-18-2023, 02:49 PM
Last Post: deanhystad
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 5,734 Sep-27-2022, 01:38 PM
Last Post: buran
  Writing to json file ebolisa 1 2,245 Jul-17-2022, 04:51 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020