Need help to write data onto an XML file after reading data from another xml file

varun7rs at gmail.com varun7rs at gmail.com
Wed May 14 09:42:38 EDT 2014


That is a very descriptive post. Since its my first time programming I am not aware of many conventions that are being used to name classes. I tried to distinguish them by naming classes in caps. I borrowed some ideas from here and there to come up with the Approach_Read.py file. What I intend to do with that file is basically define classes. I have defined all the classes that are necessary for me. Now, the lower part of the file contains a function readXML or something which I am still working on but as of now it is not relevant. Second file would be the approach file which I have to use once I generate the xml file that I need to use. So, this brings me to the last file which is really messy. 
All I want to do in the export.py file is that I'd like to pull out some data from the xml file(from the SNDLib website for the sake of topology). Since this xml file contains the source, destination and some other relevant attributes, I read them out of it. Now, I want to use the class PHY_NETWORK to create this topology. The class consists of arguments nodes, edges, etc., Here to add edges between the nodes, I call the method addEdge from the class PHY_NETWORK. But when I do that I get this error 'unicode' object has no attribute 'addInEdge. I'm not sure if I made myself clear. Once the stuff is working, I would like an xml file which looks somewhat like the one below but with attributes we need like the processing, storage and switching power.

VNEInstance schema="VNEInstance.xsd" version="">
<substrate>
<nodes>
<node capacity="975.4" costs="0.0" id="0" nodeName="0" xCoordinate="54" yCoordinate="41"/>
<node capacity="742.5" costs="0.0" id="1" nodeName="1" xCoordinate="67" yCoordinate="33"/> I'm really sorry for the trouble but once I get this thing going then I can move on with the CPLEX solving stuff.Thanks a lot for your help



More information about the Python-list mailing list