There are many ways to generate XML without third party framework
- SAX and DOM (powerful yet complex)
- Jax-B (relatively easy)
The simplest way to generate an XML is to use Jax-B (which comes as a standard from JEE6 onwards).Refer here for more details on Jax-B
But if your trying to implement this in Android(since you mentioned AndroidManifest.xml) then I recommend you to use some third party framework like Simple to avoid unwanted complications, because it is more lightweight than the rest of the above mentioned technologies and easy to use.
If your strict on not using third party library(which I do not recommend), then use SaxParser in Android, refer here for some examples.
Hope this helps