Generating HTML document from tree defined in the application