print "Name:",req.name,"version:",req.version
    for param in req.params.values():
        print_param(param)

    for struct in req.structs.values():
        print_struct(struct)

    for enum in req.enums.values():
        print_enum(enum)

def print_doc(doc):
    print "---- Global Params ----"
    for param in doc.params.values():
        print_param(param)

    print "---- Global Enums ----"
    for enum in doc.enums.values():
        print_enum(enum)

    print "---- Requests ----"
    for request in doc.requests.values():
        print_request(request)

    print "---- Replies ----"
    for reply in doc.replies.values():
        print_request(reply)


doc = parser_xml.parse("protocol.xml")
print_doc(doc)
        # TODO: see TODO above
        self.writeline("<h1>Packets</h1>")
        # Create packet files
        for packet in doc.requests.values():
            self.handle_rpacket(packet)

        for reply in doc.replies.values():
            self.handle_rpacket(reply)

        self.writeline(self.env.get_template("file_footer").render())
            
    

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print "Usage:",sys.argv[0],"input.xml output.html"
        sys.exit(0)

    input_xml = sys.argv[1]


    doc = parser_xml.parse(input_xml, "client_settings.xml")
    output_html = open(sys.argv[2], "w")
    if output_html is None:
        print "Failed to open:",sys.argv[2]
        sys.exit(1)
    
    gen = Generator(output_html, doc)
    gen.generate()