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....
I created a little demo to show how easy it can be to create a kit of classes from DTD and XSD using Maven and JAXB.
To generate from XSD schemas
In your pom.xml, you will have to add this.
[prettify] &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&...
If you are behind a proxy maybe you will want to set the proxy in Glassfish.
There are few different ways to do that.
#1 - You could use the admin web page.
You can add the proxy settings : host and port with the admin. Into the admin web page, go to the Application Server at your left. After that on your right select : JVM Settings / JVM Options.
Just add theses settings :
After that my hard drive crash two weeks ago, I deceived to host my demos on a hosting repository. I just got my Kenai repository last week, and I start to move my stuff there one by one.
I'll update all my previous posts to point to the new download path.
My Kenai page is : http://kenai.com/projects/sebastiendionne