0

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta content="text/html; charset=utf-8"><meta name="Generator" content="Amazon WorkMail v3.1.358.0"></head><body><table class="Table" width="909" style="border-collapse:collapse; width:909px"><tbody><tr><td style="background-color:#d9e1f2; border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:1px solid black; height:19px; padding:0cm 7px 0cm 7px; width:315px"><p align="center" style="text-align:center"><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Type</span></span></span></p></td><td style="background-color:#d9e1f2; border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:1px solid black; height:19px; padding:0cm 7px 0cm 7px; width:215px"><p align="center" style="text-align:center"><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Detail</span></span></span></p></td><td style="height:19px; padding:0cm 7px 0cm 7px; width:64px">&nbsp;</td></tr><tr><td style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:315px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Bot ID</span></span></span></p></td><td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:215px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">4122</span></span></span></p></td><td style="height:19px; padding:0cm 7px 0cm 7px; width:64px">&nbsp;</td></tr><tr><td style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:315px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Bot Name </span></span></span></p></td><td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:215px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Route U2K2 -CR </span></span></span></p></td><td style="height:19px; padding:0cm 7px 0cm 7px; width:64px">&nbsp;</td></tr><tr><td style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:38px; padding:0cm 7px 0cm 7px; width:315px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Bot Overview </span></span></span></p></td><td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:38px; padding:0cm 7px 0cm 7px; width:215px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">BOT to process all the SR's raised in remedy for Route U2K2. </span></span></span></p></td><td style="height:38px; padding:0cm 7px 0cm 7px; width:64px">&nbsp;</td></tr><tr><td style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:315px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Stakeholder/Business approver Name </span></span></span></p></td><td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:215px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><u><span style="color:#0563c1"><a href="mailto:Ellen.Daniel@unilever.com" style="color:#0563c1; text-decoration:underline">someemail.com</a></span></u></span></span></p></td><td style="height:19px; padding:0cm 7px 0cm 7px; width:64px">&nbsp;</td></tr><tr><td style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:315px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Estimated Run Costs</span></span></span></p></td><td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:215px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif">&nbsp;</span></span></p></td><td style="height:19px; padding:0cm 7px 0cm 7px; width:64px">&nbsp;</td></tr><tr><td style="border-bottom:1px solid black; border-left:1px solid black; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:315px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif"><span style="color:black">Margin (Euros) - Optional </span></span></span></p></td><td style="border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; height:19px; padding:0cm 7px 0cm 7px; width:215px"><p><span style="font-size:11pt"><span style="font-family:&quot;Calibri&quot;,sans-serif">&nbsp;</span></span></p></td><td style="height:19px; padding:0cm 7px 0cm 7px; width:64px">&nbsp;</td></tr></tbody></table></body></html>

电子邮件正文在 html 中转换为如下文本,我需要找到所需的数据并将这些数据放在某处。

如何拆分和获取特定的所需文本。

逻辑应用设计:https ://i.stack.imgur.com/GB3AF.png

电子邮件正文图片:https ://i.stack.imgur.com/6k89j.png

数据不在键值对中


Detail

Bot ID

4122

Bot Name 

Route U2K2 -CR 

Bot Overview 

BOT to process all the SR's raised in remedy for Route U2K2. 

Stakeholder/Business approver Name 


4

2 回答 2

0

这并不是一个完整的答案,但它可能会让你开始。

正如您在此处看到的,ALA 支持 xpath 并构建了一个 xml 解析器。如果您可以使用它,它将使一切变得更容易,并避免转换和提取的需要。据我所知,ALA 没有 html 解析器。

问题是您发布的 html 不是有效的 xml。例如,<meta>节点没有关闭,整个事物没有根节点。如果这些已修复并且您拥有有效的 xml,则使用该链接中的模板可以轻松输出您需要的内容。

例如

xpath([your valid xmlstring],'//tr/td[./p//span[./text()="Bot Name "]]/following-sibling::td/p//span[@style="color:black"]/text()')

应该输出:

Route U2K2 -CR 

相似地,

xpath([your valid xmlstring],'//tr/td[./p//span[./text()="Bot Overview "]]/following-sibling::td/p//span[@style="color:black"]/text()')

应该输出:

BOT to process all the SR's raised in remedy for Route U2K2. 

等等正如我所说,不是一个完整的答案......

于 2020-10-14T15:41:43.520 回答
0

将html转成文本后,就可以substring('<text>', <startIndex>, <length>)用来获取你想要的值了。

在使用之前substring('<text>', <startIndex>, <length>),您需要先获取<startIndex><length>

获取 startIndex

可以用indexOf(variables('var'),'Bot ID')来获取 的索引Bot ID,然后用add(indexOf(variables('var'),'Bot ID'),6)来获取后面的索引Bot ID

获取长度

您可以使用indexOf(variables('var'),'Bot Name')获取 的索引Bot Name,然后使用sub(indexOf(variables('var'),'Bot Name'),add(indexOf(variables('var'),'Bot ID'),6))获取长度。

像这样的表达:

substring(variables('var'),add(indexOf(variables('var'),'Bot ID'),6),sub(indexOf(variables('var'),'Bot Name'),add(indexOf(variables('var'),'Bot ID'),6)))

设计是这样的:

在此处输入图像描述

我做了一个测试:

在此处输入图像描述

笔记

文本必须\n以换行符开始,因此您需要根据自己的文本调整startIndexand的值。length

于 2020-10-15T01:55:25.467 回答