def main(xml_in, wad_file):
    utils.set_stage(0)
    conv = MapXML2Map(wad_file)
    try:
        xml.sax.parseString(xml_in, conv)
    except:  # noqa: E722
        raise
        utils.failParse()
    return conv._result
def main(xml_in):
    utils.set_stage(1)
    try:
        m = xml.dom.minidom.parseString(xml_in)
    except:  # noqa: E722
        utils.failParse()
    processBrushes(m)
    utils.remove_whitespace_nodes(m)
    m.getElementsByTagName('map')[0] \
     .setAttribute('stackdesc', prog.stackdescs[1])
    m.getElementsByTagName('map')[0].setAttribute('generator', __file__)
    return m.toprettyxml()
Beispiel #3
0
def main(xml_in, wad):
    utils.set_stage(2)
    global s  # FIXME remove?
    s = utils.StyleFetcher(wad)
    try:
        m = xml.dom.minidom.parseString(xml_in)
    except:  # noqa: E722
        utils.failParse()
    utils.remove_whitespace_nodes(m)
    processMap(m, wad)
    m.getElementsByTagName('map')[0] \
     .setAttribute('stackdesc', prog.stackdescs[2])
    m.getElementsByTagName('map')[0].setAttribute('generator', __file__)
    return m.toprettyxml()
def main(xml_in):
    utils.set_stage(4)
    filtered_reader = BuilderFilter(xml.sax.make_parser())
    xml_out = io.StringIO()
    filtered_reader.setContentHandler(
        XMLGenerator(xml_out, short_empty_elements=True))
    try:
        hacky = io.StringIO(xml_in)
        filtered_reader.parse(hacky)
    except xml.sax.SAXParseException as detail:
        utils.error('The XML you supplied is not valid: ' + str(detail))
    except:  # noqa E722
        raise
        utils.failParse()
    xml_out.seek(0)
    return xml.dom.minidom.parse(xml_out).toprettyxml()