We are aware of the appengine limitation relating to writing files to disk. So the idea of having a dynamic sitemap via i/o seems a bit difficult for AppEngine. So here are some ideas that we wish to validate:
For dynamic URLs your only solution since you are using Java on Google App Engine is to create a servlet that will create this response.
There are many libraries that you can use that will make sure that your XML is correct but the simplest example that can get you started will look like this:
public class SitemapsServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("application/xml");
resp.getWriter().println("<?xml version="1.0" encoding="UTF-8"?>");
resp.getWriter().println("<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">");
resp.getWriter().println(" <url>");
resp.getWriter().println(" <loc>http://www.example.com/?id=who</loc>");
resp.getWriter().println(" <lastmod>2009-09-22</lastmod>");
resp.getWriter().println(" <changefreq>monthly</changefreq>");
resp.getWriter().println(" <priority>0.8</priority>");
resp.getWriter().println(" </url>");
resp.getWriter().println("</urlset>");
}
}
For the rest of the questions make sure that you understand how the sitemaps are working and what's their purpose.