Re: [XML-SIG] Modify node attributes in XML file while parsing

2009-09-17 Thread Abhishek Kane
* * is how the XML file looks like. I want to modify the *value *of *instance *based on the *service name*. So if i search for *abc* service & modify instance value like follows : *import sys, logging, traceback from xml.dom import minidom data_file = "/tmp/data.xml" def ma

Re: [XML-SIG] Modify node attributes in XML file while parsing

2009-09-16 Thread Josh English
Everything works, but you need to write this over data.xml. I don't remember how to do this in minidom. I think writing to an output file is the only way to do this: o = open('data.xml') o.write(xmldoc.toxml()) o.close() On Wed, Sep 16, 2009 at 9:58 AM, Abhishek Kane wrote: > > > > >     >

Re: [XML-SIG] Modify node attributes in XML file while parsing

2009-09-16 Thread Stefan Behnel
Abhishek Kane wrote: > I got a bit idea about parsing XML file from online search. I need to modify > node attributes in an XML file while I read it. I could read node > attributes; but when I modify them using setAttribute, the local copy of > that node gets changed. > Is there any way to directl

[XML-SIG] Modify node attributes in XML file while parsing

2009-09-16 Thread Abhishek Kane
Hi Guys, I got a bit idea about parsing XML file from online search. I need to modify node attributes in an XML file while I read it. I could read node attributes; but when I modify them using setAttribute, the local copy of that node gets changed. Is there any way to directly modify the node attr