Power Automate XML 本地名称语法不适用于 SharePoint 表单库
Power Automate XML local-name syntax not working on SharePoint form library
我认为我的 Power Automate 作业存在语法错误,该作业试图从包含旧 InfoPath 表单的 SharePoint 表单库中读取 XML 文件。自动化步骤获取 XML 文件的列表,然后读取每个文件。 Just to get started I'm tryin to grab the last name field from the XML. But when I look at the return of my compose statement is reads like this image and not a string. 下面是 XML 的片段(请注意 InfoPath 如何包含大量名称空间噪声)和我在撰写步骤中用于提取名称的语句。
<?xml version="1.0" encoding="utf-8"?>
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:OnePRBv2:-myXSD-2017-05-05T14-19-13" solutionVersion="1.0.0.2488" productVersion="16.0.0.0" PIVersion="1.0.0.0" href="https://myportal.sharepoint.com/sites/mysite/OnePRBv21/Forms/template.xsn"?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.4"?>
<?mso-infoPath-file-attachment-present?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" 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: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/2017-05-05T14:19:13" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-US">
<my:Last_Name>Smith</my:Last_Name>
撰写声明
xpath(xml(outputs('Get_file_content')?['body']),'/*[local-name()="myFields"]/*[local-name()="Last_Name"]')
我假设因为我得到了一些东西,这意味着语法是正确的,但我不完全确定这是真的。
更新 - 查看其他一些在线示例我尝试了这种语法 xpath(xml(outputs('Get_file_content')?['body']),'/*[local-name()="myFields"]/*[local-name()="Last_Name"][0]')
但结果只是 []
你问题中的xml格式不正确;但在实际 xml 上试试这个,看看它是否有效:
xpath(xml(outputs('Get_file_content')?['body']),'//*[local-name()="myFields"]//following-sibling::*[local-name()="Last_Name"]')
我认为我的 Power Automate 作业存在语法错误,该作业试图从包含旧 InfoPath 表单的 SharePoint 表单库中读取 XML 文件。自动化步骤获取 XML 文件的列表,然后读取每个文件。
<?xml version="1.0" encoding="utf-8"?>
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:OnePRBv2:-myXSD-2017-05-05T14-19-13" solutionVersion="1.0.0.2488" productVersion="16.0.0.0" PIVersion="1.0.0.0" href="https://myportal.sharepoint.com/sites/mysite/OnePRBv21/Forms/template.xsn"?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.4"?>
<?mso-infoPath-file-attachment-present?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" 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: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/2017-05-05T14:19:13" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-US">
<my:Last_Name>Smith</my:Last_Name>
撰写声明
xpath(xml(outputs('Get_file_content')?['body']),'/*[local-name()="myFields"]/*[local-name()="Last_Name"]')
我假设因为我得到了一些东西,这意味着语法是正确的,但我不完全确定这是真的。
更新 - 查看其他一些在线示例我尝试了这种语法 xpath(xml(outputs('Get_file_content')?['body']),'/*[local-name()="myFields"]/*[local-name()="Last_Name"][0]')
但结果只是 []
你问题中的xml格式不正确;但在实际 xml 上试试这个,看看它是否有效:
xpath(xml(outputs('Get_file_content')?['body']),'//*[local-name()="myFields"]//following-sibling::*[local-name()="Last_Name"]')