cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
notj
Post Prodigy
Post Prodigy

XML parsing troubles

End-goal

To bring in old InfoPath information through Flow, into our new system in our CDS. Ideally I could target the .xml files in the Forms library directly, but I think I have to resort to moving the files to a normal Document Library and then running the flow on there.

 

Scenario

1 XML Forms Library

1 Document Library

InfoPath forms in .xml files

 

Current Flow
Get Files(Properties Only) - To get the file names

To Each

Get file content - To get the actual XML inside the .xml file

Compose_XML - to get an idea of the XML structure(shown at the bottom of the post)

@{body('Get_file_content')}

Compose_replace - to run a replace on the xmlns: replace(outputs('Compose_xml'), 'xmlns=','')  (I don't know if this is needed or not)

@{replace(outputs('Compose_XML'), 'xmlns=','')}


Compose_xpath - to attempt to do an xpath function: xpath(xml(body('Compose_replace')), 'string(/my:myFields/my:Project)')

@{xpath(xml(outputs('Compose_replace')), 'string(/my:myFields/my:Project)')}

 

Error

InvalidTemplate. Unable to process template language expressions in action 'Compose_xpath' inputs at line '1' and column '2244': 'The template language function 'xpath' parameters are invalid: the 'xpath' parameter must be a supported, well formed XPath expression. Please see https://aka.ms/logicexpressions#xpath for usage details.'.

 

XML File

 

 

<?xml version="1.0" encoding="utf-8"?>
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:Capital-Time-Form:-myXSD-2016-09-16T14-34-41" solutionVersion="1.0.0.196" productVersion="16.0.0.0" PIVersion="1.0.0.0" href="https://addresshere.com"?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.4"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService" xmlns:s1="http://microsoft.com/wsdl/types/" 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:dms="http://schemas.microsoft.com/office/2009/documentManagement/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/2016-09-16T14:34:41" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-US">
	<my:EmployeeName>Jim McJimmerson</my:EmployeeName>
	<my:Project>Big Project</my:Project>
	<my:ProjectFilter>All Projects</my:ProjectFilter>
	<my:Month>August</my:Month>
	<my:DevSetupWeek1>1</my:DevSetupWeek1>
	<my:DevSetupWeek2>1</my:DevSetupWeek2>
	<my:DevSetupWeek3>1</my:DevSetupWeek3>
	<my:DevSetupWeek4>1</my:DevSetupWeek4>
	<my:DevSetupWeek5>1</my:DevSetupWeek5>
	<my:ImplementTestWeek1></my:ImplementTestWeek1>
	<my:ImplementTestWeek2></my:ImplementTestWeek2>
	<my:ImplementTestWeek3></my:ImplementTestWeek3>
	<my:ImplementTestWeek4></my:ImplementTestWeek4>
	<my:ImplementTestWeek5></my:ImplementTestWeek5>
	<my:PlanningPMWeek1></my:PlanningPMWeek1>
	<my:PlanningPMWeek2></my:PlanningPMWeek2>
	<my:PlanningPMWeek3></my:PlanningPMWeek3>
	<my:PlanningPMWeek4></my:PlanningPMWeek4>
	<my:PlanningPMWeek5></my:PlanningPMWeek5>
	<my:DataConvWeek1></my:DataConvWeek1>
	<my:DataConvWeek2></my:DataConvWeek2>
	<my:DataConvWeek3></my:DataConvWeek3>
	<my:DataConvWeek4></my:DataConvWeek4>
	<my:DataConvWeek5></my:DataConvWeek5>
	<my:TrainingWeek1></my:TrainingWeek1>
	<my:TrainingWeek2></my:TrainingWeek2>
	<my:TrainingWeek3></my:TrainingWeek3>
	<my:TrainingWeek4></my:TrainingWeek4>
	<my:TrainingWeek5></my:TrainingWeek5>
	<my:AccCreationWeek1></my:AccCreationWeek1>
	<my:AccCreationWeek2></my:AccCreationWeek2>
	<my:AccCreationWeek3></my:AccCreationWeek3>
	<my:AccCreationWeek4></my:AccCreationWeek4>
	<my:AccCreationWeek5></my:AccCreationWeek5>
	<my:NetworkTelecomWeek1></my:NetworkTelecomWeek1>
	<my:NetworkTelecomWeek2></my:NetworkTelecomWeek2>
	<my:NetworkTelecomWeek3></my:NetworkTelecomWeek3>
	<my:NetworkTelecomWeek4></my:NetworkTelecomWeek4>
	<my:NetworkTelecomWeek5></my:NetworkTelecomWeek5>
	<my:PCSetupInstallWeek1></my:PCSetupInstallWeek1>
	<my:PCSetupInstallWeek2></my:PCSetupInstallWeek2>
	<my:PCSetupInstallWeek3></my:PCSetupInstallWeek3>
	<my:PCSetupInstallWeek4></my:PCSetupInstallWeek4>
	<my:PCSetupInstallWeek5></my:PCSetupInstallWeek5>
	<my:TotalCapHours>5</my:TotalCapHours>
	<my:TotalNonCapHours>0</my:TotalNonCapHours>
	<my:MonthValue>7</my:MonthValue>
	<my:Title>Jim_Big_Project</my:Title>
	<my:Year>2017</my:Year>
	<my:Submitted>true</my:Submitted>
	<my:ProjectTitle>Big Project</my:ProjectTitle>
	<my:Contractor>false</my:Contractor>
</my:myFields>

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
Super User
Super User

Hello @notj 

 

Check out my Solution on this post:

https://powerusers.microsoft.com/t5/Building-Flows/Reading-xml-file-from-onedrive/m-p/452156

 

I am grabbing XML files from Onedrive and transforming them into JSON to be easily read by flow in a parse json.

 

 —Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

3 REPLIES 3
v-alzhan-msft
Community Support
Community Support

Hi @notj ,

 

I'm afraid that your requirement couldn't be achieved since the "Get file content" action couldn't get the data in the file.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Jcook
Super User
Super User

Hello @notj 

 

Check out my Solution on this post:

https://powerusers.microsoft.com/t5/Building-Flows/Reading-xml-file-from-onedrive/m-p/452156

 

I am grabbing XML files from Onedrive and transforming them into JSON to be easily read by flow in a parse json.

 

 —Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

@v-alzhan-msft Why did you mark the solution when it's an answer to a question I didn't ask?

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,682)