Thanks for your interest in our products.
Working with objects placed inside Aspose.Pdf.Generator DOM(Document Object Model) is very convenient. In case you need to replace the image specified inside your XML file with some other image file placed over your system or stored inside DataBase, you can simply get the Image object using Section.GetObjectByID(....) method and it will give you direct access to the Images placed inside the whole Section object. Please take a look over the following code snippet in which I have replaced the image path with some value at runtime. For your reference, I have also attached the resultant PDF that I have generated.
//Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Get the section and then Image from the obtained section of the Pdf that
//is built from the XML template
Section sec1 = pdf1.Sections["MainPage"];
Aspose.Pdf.Generator.Image img = sec1.GetObjectByID("HeaderImage") as Aspose.Pdf.Generator.Image;
// specify new path information for Image object
img.ImageInfo.File = @"d:/pdftest/aspose-logo.png";
// specify the image file type
img.ImageInfo.ImageFileType = ImageFileType.Png;
//save the resultant PDF
I would recommend you to please visit the following link for more information on how to Use Xml as Template