def dump(obj,file): x = Xmlizer() xdoc = XmlDocument() xe = x.toXml(obj,xdoc) xdoc.appendChild(xe) # fos = FileOutputStream(file) xdoc.write(fos) fos.close()
def dump(obj, file): x = Xmlizer() xdoc = XmlDocument() xe = x.toXml(obj, xdoc) xdoc.appendChild(xe) # fos = FileOutputStream(file) xdoc.write(fos) fos.close()
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
def readDoc(self,xmlfile = "dsm2.xml"): self.xdoc = XmlDocument.createXmlDocument(FileInputStream(xmlfile),0)
def buildDocumentUrl(self, url): from com.sun.xml.tree import XmlDocument return Document(XmlDocument.createXmlDocument(url))
def createDocument(self): from com.sun.xml.tree import XmlDocument return Document(XmlDocument())
def load(obj,file): x = Xmlizer() xdoc = XmlDocument.createXmlDocument(FileInputStream(file),0) x.fromXml(obj,xdoc.getDocumentElement())
def toxml(obj): x = Xmlizer() xdoc = XmlDocument() return x.toXml(obj, xdoc)
def load(obj, file): x = Xmlizer() xdoc = XmlDocument.createXmlDocument(FileInputStream(file), 0) x.fromXml(obj, xdoc.getDocumentElement())