How to generate xarchive from ipa file of iPhone

I am going to generate the iPhone application (.ipa) file from a script file(not through Xcode). Now the requirement is how to generate the xarchive file from the script generated ipa file.