Posted by survivant
on March 25, 2009 at 8:49 AM PDT
This is a better version that allow you to read a web.xml in one line of code and get a Java object that represent the xml. Webapp 2.2 to 3.0 are supported. Using JABX.
I did a previous post about how to do it with XMLBean or JABX, but it was more an example how to do it. This time is the real deal.
I used JABX to generate the java classes from the schemas and use that to parse the web.xml.
The result is a simple class : WebAppLoader that will load the web.xml.
Here a example :
WebappLoader webappLoader = new WebappLoader();
WebApp webapp = webappLoader.load("/web-2.2.xml");
The object WebApp contains all the infos extracted from the web.xml. The representation is based on webapp 3.0.
you can get the source code from my repository : http://kenai.com/projects/sebastiendionne/sources/repository/show/dtd-schemas-generator