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
  Capturing BS4 values into DF and writing to CSV cubangt 18 1,854 Sep-05-2023, 01:57 PM
Last Post: cubangt
Video doing data treatment on a file import-parsing a variable EmBeck87 15 2,670 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
  Read text file, modify it then write back Pavel_47 5 1,503 Feb-18-2023, 02:49 PM
Last Post: deanhystad
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,308 Sep-27-2022, 01:38 PM
Last Post: buran
  Writing to json file ebolisa 1 970 Jul-17-2022, 04:51 PM
Last Post: deanhystad
  Modify values in XML file by data from text file (without parsing) Paqqno 2 1,580 Apr-13-2022, 06:02 AM
Last Post: Paqqno
  Overwrite values in XML file with values from another XML file Paqqno 5 3,213 Apr-01-2022, 11:33 PM
Last Post: Larz60+
  Parsing xml file deletes whitespaces. How to avoid it? Paqqno 0 1,011 Apr-01-2022, 10:20 PM
Last Post: Paqqno
  Writing to External File DaveG 9 2,411 Mar-30-2022, 06:25 AM
Last Post: bowlofred
  How to split file by same values from column from imported CSV file? Paqqno 5 2,705 Mar-24-2022, 05:25 PM
Last Post: Paqqno

Forum Jump:

User Panel Messages

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