def _writeContents(self, fileobj, ind): indent(fileobj, ind) opentag(fileobj, self.TAG_LINEARRING) pointseriesout = PointSeries(self.pointseries) pointseriesout.append(self.pointseries[0]) writesimple(fileobj, ind + 1, TAG_COORDINATES, _gencoords(*pointseriesout)) indent(fileobj, ind) closetag(fileobj, self.TAG_LINEARRING)
def write(self, fileobj, ind): if self.value is not None: writesimple(fileobj, ind, self.tag, self.value, self.attrs) else: indent(fileobj, ind) opentag(fileobj, self.tag, self.attrs) for key, value in self.childtags.items(): writesimple(fileobj, ind + 1, key, value) self._writeContents(fileobj, ind + 1) for childobj in self.childobjs: childobj.write(fileobj, ind + 1) indent(fileobj, ind) closetag(fileobj, self.tag)
def write(self,gpx,file): root = self.gpx(gpx) xmlutil.indent(root) ElementTree.ElementTree(root).write(file)