When you try to get using XPath '//Invoice' then the selected node is not text, rather it is an element.
So try to change your code as below and then it should work.
ifXmlDoc.SelectSingleNode(XPath, XmlNode) then
XmlNode.AsXmlElement().WriteTo(Result);
exit(Result);
Was this reply helpful?YesNo
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.