Hello,
We recently ran into an issue where we have lost an InfoPath form containing necessary information and I am attempting to see if we can use flow to recover some of it. We have the xml files so we have all the data necessary but anytime we attempt to put in any xpath query we get an error.
here is an example of an xml file we are attempting to get data out of.
<?xml version="1.0"?><?mso-infoPathSolution name="urn:schemas-microsoft-com: office:infopath:AccRept-2013-14:-myXSD-2012-08-08T17-37-13" solutionVersion="1.0.0.443" productVersion="14.0.0.0" PIVersion="1.0.0.0" href="https://portal1.cbsd.org/WorkflowForms/AccRept_201314/Forms/template.xsn"?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?><my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" xmlns:ma="http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes" xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields" xmlns:q="http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:dms="http://schemas.microsoft.com/office/2009/documentManagement/types" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:tns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-08-08T17:37:13" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-US">
<my:Building></my:Building>
<my:ReportDate></my:ReportDate>
<my:FormSubmitter></my:FormSubmitter>
<my:AccidentDetails>
<my: Student>true</my: Student>
<my: Other>false</my: Other>
<my: OtherSpecify></my: OtherSpecify>
<my:LastName></my:LastName>
<my:FirstName></my:FirstName>
<my:Male></my:Male>
<my:Female></my:Female>
<my:HomePhone></my:HomePhone>
<my:Grade></my:Grade>
<my:Homeroom></my:Homeroom>
<my: SchoolBuilding></my: SchoolBuilding>
<my: SchoolGrounds></my: SchoolGrounds>
<my: OffPremises></my: OffPremises>
<my: SpecificLocation></my: SpecificLocation>
<my: DateTimeAccident></my: DateTimeAccident>
<my: DateTimeReported></my: DateTimeReported>
<my:ActivityTimeofAccident></my:ActivityTimeofAccident>
<my:InjuryDescription></my:InjuryDescription>
</my:AccidentDetails>
<my: Disposition>
<my:Yes_FirstAid></my:Yes_FirstAid>
<my:No_FirstAid></my:No_FirstAid>
<my:TreatedBy></my:TreatedBy>
<my:TreatedByPosition></my:TreatedByPosition>
<my:NatureOfTreatment></my:NatureOfTreatment>
<my:ReferredToNurse></my:ReferredToNurse>
<my:ReferredToPhysician></my:ReferredToPhysician>
<my:ReferredToHospital></my:ReferredToHospital>
<my:ReferredToOther></my:ReferredToOther>
<my: DateTimeReferredToNurse></my: DateTimeReferredToNurse>
<my: DateTimeReferredToPhysician xsi:nil="true"></my: DateTimeReferredToPhysician>
<my: DateTimeReferredToHospital xsi:nil="true"></my: DateTimeReferredToHospital>
<my: DateTimeReferredToOther xsi:nil="true"></my: DateTimeReferredToOther>
<my: PhysicianName></my: PhysicianName>
<my:HospitalName></my:HospitalName>
<my: DateTimeParentsNotified></my: DateTimeParentsNotified>
<my: PersonNotifyingParents></my: PersonNotifyingParents>
<my:NurseFollowUp></my:NurseFollowUp>
<my:AdditionalTreatment></my:AdditionalTreatment>
</my: Disposition>
<my: SubmitApprove>
<my:group_3></my:group_3>
<my:group_4></my:group_4>
<my:NurseEmail></my:NurseEmail>
<my:AdminEmail></my:AdminEmail>
</my: SubmitApprove>
<my:Reviewed>
<my:NurseReview>
<my:NurseName></my:NurseName>
<my:NurseReviewDate xsi:nil="true"></my:NurseReviewDate>
<my:NurseReviewed></my:NurseReviewed>
</my:NurseReview>
<my:AdminReview>
<my:AdminName></my:AdminName>
<my:AdminReviewDate xsi:nil="true"></my:AdminReviewDate>
<my:AdminReviewed></my:AdminReviewed>
</my:AdminReview>
</my:Reviewed>
<my:HiddenFields>
<my:AccidentFormStatus></my:AccidentFormStatus>
<my:WhenCreated xsi:nil="true"></my:WhenCreated>
<my:ApproverNumber></my:ApproverNumber>
<my:NextFormApprover></my:NextFormApprover>
<my:CurrentApprover></my:CurrentApprover>
</my:HiddenFields>
</my:myFields>
There is data in the file but due to confidentiality reasons I removed it from the post. The issue I get is when I attempt to run any xpath flow expressions to pull data I always get an error. For example in order to pull home phone I have attempted.
xpath(xml(body('Get_file_content')),'string(my:myFields/my:AccidentDetails/my:HomePhone)')
xpath(xml(body('Get_file_content')),'my:myFields/my:AccidentDetails/my:HomePhone')
xpath(xml(body('Get_file_content')),'//my:HomePhone')in every instance I get an error. I have tested all these on a free online xpath query tester and they all return the value I need it, the issue only seems to be with flow itself. Is there something wrong with my xpath or can this not be done with flow.
*Edit: I added spaces in a few xml nodes to prevent them from being viewed as emoji's.