import sys

# note: gdslib is your module that was generated by generateDS.py
import gdslib

def showIndent(outfile, level):
    """Empty function that does not produce any whitespace.
    """
    pass

def parse(inFileName):
    # replace showIndent with a version that adds *no* whitespace.
    gdslib.showIndent = showIndent
    doc = gdslib.parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = gdslib.get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'people'
        rootClass = gdslib.peopleType
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_=rootTag, 
        namespacedef_='xmlns:pl="http://kuhlman.com/people.xsd"')
    return rootObj

def main():
    args = sys.argv[1:]
    if len(args) == 1:
        parse(args[0])
    else:
        usage()

if __name__ == '__main__':
    #import pdb; pdb.set_trace()
    main()

