ok, without getting into java plugins etc there is one way I can think of to do this, you may not like it but typically I like to keep things within the environment I am working in, the more plugins and thirdparty apps you have the more you have to manage and keep on top of IMO.
So, create a BO that has one large text field call it XMLOut or similar (I use MS SQL, I would make it varchar(max)) and the only other item in the BO needs to be the relationship back to the invoice header.
Write a process to find the invoice you want to export, and update XMLOut field by field with the XML tags, so XMLOut=TRIM(XMLOut)+'<InvoiceNumber>'+InvoiceHeader.InvoiceNumber+'</InvoiceNumber>' and so on and so forth until you have done all the header fields, then run through the children lines doing the same, Then you will need to close off the xml to get the tags right.
Once the string is built, all you have to do is a text document out of the one XMLOut Field.
If you want to be efficient/Tidy, delete the XMLOut record when you are done.
Its not awesome but it would work, and all your logic/coding is still within aware.