Hello Friends,

I am still working on the script to write data onto the xml file and now I've 
got a problem.

This is how my xml file looks now but I intend to add attributes to demands. I 
am not able to do it properly.
substrate>
<nodes>
<node Name="u'Aachen'" ProcessingCapacity="20" StorageCapacity="38" 
SwitchingCapacity="45" TotalDemands="5" nodenum="1" xCoordinate="u'6.04'" 
yCoordinate="u'50.76'">
<demands/>
</node>
<node Name="u'Augsburg'" ProcessingCapacity="21" StorageCapacity="39" 
SwitchingCapacity="46" TotalDemands="2" nodenum="2" xCoordinate="u'10.9'" 
yCoordinate="u'48.33'">
<demands/>
</node>

My class for nodes. I have a class for DEMAND but I don't want to populate the 
post with all of it.
class PHY_NODES:
    def __init__(self, nodeID, nodenum, x, y, capacity_proc, capacity_stor, 
capacity_switch, totaldemand, demands):
        self.id = nodeID
        self.nodenum = nodenum
        self.x = x
        self.y = y
        self.capacity_proc = capacity_proc
        self.capacity_stor = capacity_stor
        self.capacity_switch = capacity_switch
        self.totaldemand = totaldemand
        self.demands = demands

    def addDemand (self, demand):
        self.demands.append( demand )  

The problem I have is in writing the demands. I generate the necessary stuff 
for it but when I try and append it, it doesn't seem to work. I'd be glad to 
share my files if you need them. Could you please help me fix this?

Thank You

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to