Ejemplo n.º 1
0
Archivo: World.py Proyecto: dqyi11/DCG
 def from_xml(self, node, doc):
     for c in node.childNodes:
         if c.nodeType == c.ELEMENT_NODE:
             if c.nodeName == "object":
                 o = Object()
                 o.from_xml( c, doc )
                 self.objects.append( o )
Ejemplo n.º 2
0
 def from_xml(self, node, doc):
     if node.nodeName == "grounding":
         for c in node.childNodes:
             if c.nodeType == c.ELEMENT_NODE:
                 if c.nodeName == "grounding_set":
                     for cc in c.childNodes:
                         if cc.nodeType == cc.ELEMENT_NODE:
                             if c.nodeName == "object":
                                 obj = Object()
                                 obj.from_xml( cc, doc )
                             elif c.nodeName == "region":
                                 reg = Region()
                                 reg.from_xml( cc, doc )
                             elif c.nodeName == "constraint":
                                 cons = Constraint()
                                 cons.from_xml( cc, doc )
Ejemplo n.º 3
0
Archivo: Region.py Proyecto: dqyi11/DCG
 def from_xml(self, node, doc):
     self.type = node.getAttribute("type")
     for c in node.childNodes:
         if c.nodeType == c.ELEMENT_NODE:
             if c.nodeName == "object":
                 self.object = Object()
                 self.object.from_xml( c, doc )
Ejemplo n.º 4
0
Archivo: Region.py Proyecto: dqyi11/DCG
class Region(object):


    def __init__(self):
        self.type = None
        self.object = None
        
    def from_xml(self, node, doc):
        self.type = node.getAttribute("type")
        for c in node.childNodes:
            if c.nodeType == c.ELEMENT_NODE:
                if c.nodeName == "object":
                    self.object = Object()
                    self.object.from_xml( c, doc )
    
    def to_xml(self, parentNode, doc):
        node = doc.createElement("region")
        parentNode.appendChild(node)
        node.setAttribute("type", self.type)
        if self.object != None:
            self.object.to_xml(node, doc)