I don't think you can do this, but why would you want to do it in the first place? it comes dangerously close to self-mnodifying code.
The reason for this is likely to be due to the seperation of roles as identified by Sun.
The component provider may have provided the web application packaged into a war file.
The deployer may then want to make configuration changes before deployment of the application.
Some other application server vendors provide tools that allow the deployment descriptors to be edited without having to manually unpack the archive.
Yes, My mean and reasons are certainly with compliance to the notion of separation of roles. I would further want a deployer to automate his tasks, and preferably using java code.
Anyway as a software developer, I want my daily build process to be fully automatic, And to generate edit my web.xml's and any other files automatically, and I'm searching for some standard for that, I wouldn't want to reinvent the wheel; Unless that wheel wasn't invented yet.