Code for content generation and XML parsing