mapping.loadMapping(webXmlMapping);
InputStream webXml = getClass().getResourceAsStream("web.xml");
Unmarshaller unmarshaller = new Unmarshaller(mapping);
WebAppDD config = (WebAppDD)unmarshaller.unmarshal(new InputStreamReader(webXml));
OutputFormat of = new OutputFormat();
of.setIndenting(true);
of.setIndent(4); // 2-space indention
of.setLineWidth(16384);
// As large as needed to prevent linebreaks in text nodes
of.setDoctype(
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN",
"http://java.sun.com/dtd/web-app_2_3.dtd");
FileWriter writer = new FileWriter("newWeb.xml");
XMLSerializer serializer = new XMLSerializer(writer, of);