Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Azure逻辑应用程序中解析XML文档中的Word格式文本_Xml_Xml Parsing_Azure Logic Apps - Fatal编程技术网

在Azure逻辑应用程序中解析XML文档中的Word格式文本

在Azure逻辑应用程序中解析XML文档中的Word格式文本,xml,xml-parsing,azure-logic-apps,Xml,Xml Parsing,Azure Logic Apps,我正在尝试解析SharePoint表单库中的XML文件,其中用户将格式化的Word文档文本复制/粘贴到文本字段中。结果是XML中包含XML。我在获取内容时遇到了困难,但在另一个问题的帮助下,这个语法起作用了xpath(xml(outputs('Get_file_content')?['body']),'/*[local-name()=“myFields”]//以下同级::*[local-name()=“Request_Description”],[0]。结果是这样的 <my:Request

我正在尝试解析SharePoint表单库中的XML文件,其中用户将格式化的Word文档文本复制/粘贴到文本字段中。结果是XML中包含XML。我在获取内容时遇到了困难,但在另一个问题的帮助下,这个语法起作用了
xpath(xml(outputs('Get_file_content')?['body']),'/*[local-name()=“myFields”]//以下同级::*[local-name()=“Request_Description”],[0]
。结果是这样的

<my:Request_Description xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2017-05-05T14:19:13">
  <xhtml:html xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml">
    <xhtml:div>
      <xhtml:font size="1" face="CIDFont+F6">
        <xhtml:font size="1" face="CIDFont+F6">
          <xhtml:p>This is where the request description goes and the result we want</xhtml:p>
</xhtml:font>
      </xhtml:font>
    </xhtml:div>
</xhtml:html>
</my:Request_Description>

这是由表单上的RTF控件引起的,用户可以在该控件中输入表单上的文本框,然后该控件将其转换为您看到的XML。由于没有一致性,我想知道使用xpath是否不可行,但我不确定还能做些什么。

您可以使用以下表达式:

xpath(xml(outputs('Get_file_content')?['body']), 'string(/*[local-name()="Request_Description"]/*[local-name()="html"]/*[local-name()="div"]/*[local-name()="font"]/*[local-name()="font"]/*[local-name()="p"])')
trim(xpath(xml(outputs('Get_file_content')?['body']), 'string(/*[local-name()="Request_Description"])'))
您可以参考这篇文章来了解
xpath
的具体用法

==================================更新===========================

您可以使用,然后使用以下表达式:

xpath(xml(outputs('Get_file_content')?['body']), 'string(/*[local-name()="Request_Description"]/*[local-name()="html"]/*[local-name()="div"]/*[local-name()="font"]/*[local-name()="font"]/*[local-name()="p"])')
trim(xpath(xml(outputs('Get_file_content')?['body']), 'string(/*[local-name()="Request_Description"])'))

谢谢,这很有帮助,而且很有效,但是我需要更新我的问题,因为我忘记了提到每个XML表单都有不同的内容,因此
xpath
语法将发生变化。我开始认为这不可能适用于所有情况。请看我对问题的编辑,了解我的另一个意思。嗨,@pretzelb。我已经更新了我的答案,这个表达式应该可以解决你的问题。如果只有一些样式标记,那么这个表达式应该没有问题。