Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71758

Problem in writing demands to the xml file

Newsgroups comp.lang.python
Date 2014-05-19 06:42 -0700
Message-ID <94945828-0caf-4534-bdaa-5371bdda6dbe@googlegroups.com> (permalink)
Subject Problem in writing demands to the xml file
From varun7rs@gmail.com

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Problem in writing demands to the xml file varun7rs@gmail.com - 2014-05-19 06:42 -0700
  Re: Problem in writing demands to the xml file "Rhodri James" <rhodri@wildebst.org.uk> - 2014-05-19 22:30 +0100
  Re: Problem in writing demands to the xml file varun7rs@gmail.com - 2014-05-20 01:06 -0700

csiph-web