【发布时间】:2015-10-11 10:59:19
【问题描述】:
响应 Post 中的请求,我得到一个 xml 文件,其中包含两个 pdf 文件(如我附上的示例所示)。 我的问题是我无法提取上面的文件。
--MIMEBoundary_90d05142045ade9e6fce7c43cb81856f3bd2630a9667b995
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.a0d05142045ade9e6fce7c43cb81856f3bd2630a9667b995@apache.org>
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body><a:RispostaCDPDWSBeanProduciRetro xmlns:a="http://virtuale.ws.cdpd.aci.it/data" xmlns="http://ws.cdpd.aci.it/data">
<a:Result
<esiti>
<codice>0</codice>
<descrizione>ESITO OK</descrizione>
</esiti>
<tipoEsito>1</tipoEsito>
</a:Result>
<a:FilePdf1>
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:b0d05142045ade9e6fce7c43cb81856f3bd2630a9667b995@apache.org"/>
</a:FilePdf1>
<a:tipoDocumento>2</a:tipoDocumento>
<a:FilePdf2>
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:40d05142045ade9e6fce7c43cb81856f3bd2630a9667b995@apache.org"/>
</a:FilePdf2>
</a:RispostaCDPDWSBeanProduciRetro>
</soapenv:Body>
</soapenv:Envelope>
--MIMEBoundary_90d05142045ade9e6fce7c43cb81856f3bd2630a9667b995
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <b0d05142045ade9e6fce7c43cb81856f3bd2630a9667b995@apache.org>
%PDF-1.4........pdf1 body...........%%EOF
--MIMEBoundary_90d05142045ade9e6fce7c43cb81856f3bd2630a9667b995
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <40d05142045ade9e6fce7c43cb81856f3bd2630a9667b995@apache.org>
%PDF-1.4........pdf2 body...........%%EOF
--MIMEBoundary_90d05142045ade9e6fce7c43cb81856f3bd2630a9667b995--
【问题讨论】:
-
你能解释一下你到目前为止所做的尝试,展示你的理解,让我们知道你卡在哪里
-
欢迎来到 Stack Overflow。当您说“我无法提取文件..”时,您的意思是您不知道如何提取文件,或者您尝试的方式无法成功提取文件?如果是后者,请将您尝试用于提取文件的代码添加到您的问题文本中。如果是前者,那么恐怕您将不得不掌握可与 Delphi 一起使用的几个 XML 解析器之一。
-
您可能需要查找 MTOM 和 XOP。如果 Delphi 没有明确的 MTOM 支持,请考虑寻找一些 MIME 库来解析 MIME 信封。
-
我试图搜索网络但不知道从哪里开始,因为我对使用解析器的经验很少。我能够识别每个 pdf 文件的开始点和结束点(Content-ID:<......>),但不能提取代码组件 pdf 文件。
标签: xml delphi pdf delphi-2010