Ejemplo n.º 1
0
def dump(obj,file):
    x = Xmlizer()
    xdoc = XmlDocument()
    xe = x.toXml(obj,xdoc)
    xdoc.appendChild(xe)
    #
    fos = FileOutputStream(file)
    xdoc.write(fos)
    fos.close()
Ejemplo n.º 2
0
def dump(obj, file):
    x = Xmlizer()
    xdoc = XmlDocument()
    xe = x.toXml(obj, xdoc)
    xdoc.appendChild(xe)
    #
    fos = FileOutputStream(file)
    xdoc.write(fos)
    fos.close()
Ejemplo n.º 3
0
 def toXml(self):
   xdoc = XmlDocument()
   root = xdoc.createElement("dsm2")
   xdoc.appendChild(root)
   node = xdoc.createElement("titles")
   root.appendChild(node)
   self.appendElementsFromArray(self.titles,xdoc,node,"titles")
   node = xdoc.createElement("scalars")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.scalars,xdoc,node)
   node = xdoc.createElement("inputpaths")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.inputpaths,xdoc,node)
   node = xdoc.createElement("outputpaths")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.outputpaths,xdoc,node)
   node = xdoc.createElement("io_files")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.io_files,xdoc,node)
   node = xdoc.createElement("junctions")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.junctions,xdoc,node)
   node = xdoc.createElement("list_chan")
   root.appendChild(node)
   self.appendElementsFromArray(self.list_chan,xdoc,node,"list_chan")
   node = xdoc.createElement("reservoirs")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.reservoirs,xdoc,node)
   node = xdoc.createElement("channels")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.channels,xdoc,node)
   node = xdoc.createElement("irreg_geom")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.irreg_geom,xdoc,node)
   node = xdoc.createElement("xsects")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.xsects,xdoc,node)
   node = xdoc.createElement("gates")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.gates,xdoc,node)
   node = xdoc.createElement("translations")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.translations,xdoc,node)
   node = xdoc.createElement("types")
   root.appendChild(node)
   self.appendElementsFromAssoc(self.types,xdoc,node)
   return xdoc
Ejemplo n.º 4
0
 def readDoc(self,xmlfile = "dsm2.xml"):
   self.xdoc = XmlDocument.createXmlDocument(FileInputStream(xmlfile),0)
Ejemplo n.º 5
0
 def buildDocumentUrl(self, url):
     from com.sun.xml.tree import XmlDocument
     return Document(XmlDocument.createXmlDocument(url))
Ejemplo n.º 6
0
 def createDocument(self):
     from com.sun.xml.tree import XmlDocument
     return Document(XmlDocument())
Ejemplo n.º 7
0
    def buildDocumentUrl(self, url):
        from com.sun.xml.tree import XmlDocument

        return Document(XmlDocument.createXmlDocument(url))
Ejemplo n.º 8
0
def load(obj,file):
    x = Xmlizer()
    xdoc = XmlDocument.createXmlDocument(FileInputStream(file),0)
    x.fromXml(obj,xdoc.getDocumentElement())
Ejemplo n.º 9
0
def toxml(obj):
    x = Xmlizer()
    xdoc = XmlDocument()
    return x.toXml(obj, xdoc)
Ejemplo n.º 10
0
def load(obj, file):
    x = Xmlizer()
    xdoc = XmlDocument.createXmlDocument(FileInputStream(file), 0)
    x.fromXml(obj, xdoc.getDocumentElement())