ocarina/src/base/bt/xm.py

44 lines
708 B
Python

#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Jan 4, 2010 3:27:05 PM$"
import xml.dom.minidom as xml
from bt.file import *
global document
document = None
def new():
global document
document = xml.Document()
def element(name):
global document
return document.createElement(name)
def text(name):
global document
return document.createTextNode(name)
def append(child,root=None):
if root==None:
global document
document.appendChild(child)
return
root.appendChild(child)
def write(path):
global document
out = fopen(path,'w')
out.write(document.toprettyxml(indent=" "))
out.close()