Thanks for the reply Nukkumatti,
I'm using InfoPath 2007 and it didn't like things like thisXDocument and IXMLDOMDocument. I tried C# 2003 compatible and it didn't like async, loadXML & documentElement.
If possible I was hoping for code in VB as I don't know the other languages.
Thanks,
Simon