加入所有P标签XPath Power Automate
一直在挣扎着流动,以在HTML表中添加Excel中的行。
我遵循了youtube
这将遍历所有项目,然后检索第一个p 1 ,下一个迭代p 2 等等。 “ XPATH(XML(XML('XMLHTML'))),Concat('// Table [.1] // TR [.2] // td [.1] // P [',item(item(Item(),']/ /text()'))?[0]”
< p class =“ msonormal”> < span lang =“ en-us” style =“ font-size:11.0pt; color:black; border; border:note windowtext 1.0pt; padding; padding; padding:0cm“> glu900 l700/800/800/1800< lt;/span> < span lang =“ en-us” style =“ font-size:11.0pt; border:none windowText 1.0pt; padding; padding:0cm“>/2100/2600/2602;</span> < span lang =“ en-us” style =“ font-size:11.0pt; color:black; border:none window text 1.0pt; padding; padding:0cm“> 5g;<</span> < span lang =“ en-us” style =“ font-size:11.0pt; border:note window Text 1.0pt; padding; padding:0cm“> 3< span style =“ color:color:black”>行业</span></span> </p>
png“ rel =” nofollow noreferrer“> 2 // td 3 // p [.1] // text()“
我只会检索第一项。 我想将所有5个元素加入同一字符串,然后在下一组P标签中迭代
这是我发现的,但是当它不以xpath中的text()函数结尾时,我不知道如何迭代它。 XPATH(XML(XML('XMLHTML'))),'字符串(// Table // tr 2 // td 3 // p [',item(),'])')?[0]
错误消息
模板操作的执行“选择”失败:评估 '查询'动作'其中'expression'{“ funcid”: “ @xpath(xml(upputs('xmlhtml')), concat('// table 1 // tr 2 // td 1 // p [',item(),'] // text()'))?[0]”, “ siteName”:“ @xpath(xml(uptoughs('xmlhtml')), concat('// table 1 // tr 2 // td 2 // p [',item(),'] // text()')?[0]”, “技术”:“ @xpath(xml(XML('xmlhtml')),), 'string(//表 1 // tr 2 // td 3 // p [',item(),'])')?[0]”,“注释”: “ @xpath(xml(upputs('xmlhtml')),), concat('// table 1 // tr 2 // td 4 // p [',item(),'] // text()'))?[0]”}' 失败:“模板语言函数” XPath期望两个 参数:XML对象和XPATH表达式。功能是 用“ 4”参数调用。请看看 https://aka.ms/logicexpressions#xpath 用于用法的详细信息。
所以,最后 我如何将P-TAG列表中的所有5个元素串联到一行中,如何通过Power Automate中的元素迭代?
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="939"
style="width:703.95pt; margin-left:.1pt; border-collapse:collapse">
<tbody>
<tr style="height:15.75pt">
<td width="54" nowrap=""
style="width:40.8pt; border:solid windowtext 1.0pt; padding:0cm 3.5pt 0cm 3.5pt; height:15.75pt">
<p class="MsoNormal"><b><span
style="font-size:11.0pt; color:black; border:none windowtext 1.0pt; padding:0cm">FuncID</span></b>
</p>
</td>
<td width="197" nowrap=""
style="width:147.45pt; border:solid windowtext 1.0pt; border-left:none; padding:0cm 3.5pt 0cm 3.5pt; height:15.75pt">
<p class="MsoNormal"><b><span
style="font-size:11.0pt; color:black; border:none windowtext 1.0pt; padding:0cm">SiteName</span></b>
</p>
</td>
<td width="485" nowrap=""
style="width:364.1pt; border:solid windowtext 1.0pt; border-left:none; padding:0cm 3.5pt 0cm 3.5pt; height:15.75pt">
<p class="MsoNormal"><b><span
style="font-size:11.0pt; color:black; border:none windowtext 1.0pt; padding:0cm">Technology</span></b>
</p>
</td>
<td width="202" nowrap=""
style="width:151.6pt; border:solid windowtext 1.0pt; border-left:none; padding:0cm 3.5pt 0cm 3.5pt; height:15.75pt">
<p class="MsoNormal"><b><span style="font-size:11.0pt; color:black">Comments</span></b></p>
</td>
</tr>
<tr style="height:43.4pt">
<td width="54" nowrap=""
style="width:40.8pt; border:solid windowtext 1.0pt; border-top:none; padding:0cm 3.5pt 0cm 3.5pt; height:43.4pt">
<p class="MsoNormal"><span style="font-size:11.0pt">T223566</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">T335125</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">T311000</span></p>
</td>
<td width="197" nowrap=""
style="width:147.45pt; border-top:none; border-left:none; border-bottom:solid windowtext 1.0pt; border-right:solid windowtext 1.0pt; padding:0cm 3.5pt 0cm 3.5pt; height:43.4pt">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Testing1 test1 test1</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Testing2 test2 test2</span></p>
<p class="MsoNormal"><span lang="EN-US">Testing 3 test3 test3</span></p>
</td>
<td width="485" nowrap=""
style="width:364.1pt; border-top:none; border-left:none; border-bottom:solid windowtext 1.0pt; border-right:solid windowtext 1.0pt; padding:0cm 3.5pt 0cm 3.5pt; height:43.4pt">
<p class="MsoNormal"><span lang="EN-US">GLU900 L700/800/1800/2100/2600/2602 5G 4 Sec</span>tor<span
lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"
style="font-size:11.0pt; color:black; border:none windowtext 1.0pt; padding:0cm">GLU900
L700/800/1800</span><span lang="EN-US"
style="font-size:11.0pt; border:none windowtext 1.0pt; padding:0cm">/2100/2600/2602
</span><span lang="EN-US"
style="font-size:11.0pt; color:black; border:none windowtext 1.0pt; padding:0cm">5G
</span><span lang="EN-US"
style="font-size:11.0pt; border:none windowtext 1.0pt; padding:0cm">5</span><span lang="EN-US"
style="font-size:11.0pt; color:black; border:none windowtext 1.0pt; padding:0cm"> sector</span>
</p>
</td>
<td width="202" nowrap=""
style="width:151.6pt; border-top:none; border-left:none; border-bottom:solid windowtext 1.0pt; border-right:solid windowtext 1.0pt; padding:0cm 3.5pt 0cm 3.5pt; height:43.4pt">
<p class="MsoNormal"><span lang="EN-US"
style="font-size:11.0pt; border:none windowtext 1.0pt; padding:0cm"> </span></p>
<p class="MsoNormal"><span lang="EN-US"
style="font-size:11.0pt; color:black; border:none windowtext 1.0pt; padding:0cm">5G will be
activated tomorrow</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">3-D</span></p>
</td>
</tr>
</tbody>
br erik
更新流
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,为了使它起作用,我必须从您的HTML中删除
&amp; nbsp;
数据,它不喜欢它。看看你的状况。您的XPath查询有一些选择,这完全取决于您想要实现的内容的细节。例如,尝试这些...
// p/span/text()
// p/descendant ::*/text()
取决于您选择的哪个,它们将返回一个值数组,如果外观,它将忽略所有空白行。
我在流中使用了第二个XPath查询测试,该查询产生以下结果...
这是初始化一个包含HTML数据的变量后的步骤(再次,删除
&amp; amp; nbsp; 值)...
Firstly, to make it work, I had to remove the
data from your HTML, it didn't like it. See how you go though.
There are a few options for your XPath query, it all depends on the specifics of what you want to achieve. Try these for example ...
//p/span/text()
//p/descendant::*/text()
Depending on which one you choose, they will return an array of values and by the looks if it, it will ignore all of the blank rows.
I tested with the second XPath query in my flow which yielded the following result ...
This was the step after initializing a variable which contained your HTML data (again, removing the
values though) ...
我不擅长HTML,因此我将文件转换为PDF,并使用AI Builder读取PDF文件内容,并且对我来说很好,也许您可以尝试一下。
I'm not good at HTML, so I convert the file to PDF, and use AI Builder to read the PDF file content and it's working well for me, maybe you can try it.