在我的 Biztalk Orchestration 设计器(表达式编辑器)中,我需要从名为
<Any>
的元素中提取值。我创建了一个字符串变量并在该字段上执行了 xpath,但该变量结果为 null。
该元素在我的 xml 文件中被命名为“Base64Container”。
这是xpath:
vMyVariable = xpath(mKithResult.mmpBody, "/*[local-name()='Message' and namespace-uri()='http://www.kith.no/xmlstds/labsvar/2012-02-15']/*[local-name()='ServReport']/*[local-name()='RefDoc']/*[local-name()='Content'][1]/*[local-name()='Base64Container']");
问题出在这部分:
/*[local-name()='Base64Container']");
如何从我的 xml 中名为 Base64Container 的元素中提取值?
这是我的 xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Answer report for pathology KiTH ver 1.4 created by Labvantage Medical Suite, SoftwarePoint AB
Source: samplereport_xml_kith14_pathology
-->
<Message xmlns="http://www.kith.no/xmlstds/labsvar/2012-02-15" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kith.no/xmlstds/labsvar/2012-02-15 svar-v1.4.xsd">
<Type V="SVAR_LAB" DN="Svarrapport-Laboratoriemedisin"/>
<MIGversion>v1.4 2012-02-15</MIGversion>
<!-- GenDate: reportdatetime -->
<GenDate V="2023-11-13T11:04:00"/>
<MsgId>13e61dcbbbe70385</MsgId>
<ServReport>
<!-- ServType_new: N - New report -->
<ServType V="N" DN="Ny"/>
<!-- IssueDate: sample.createdt -->
<IssueDate V="2023-11-13T11:02:00"/>
<Status V="F" DN="Enrt"/>
<Ack V="J" DN="Avsereftelse"/>
<MsgDescr V="HT" DN="Cygi"/>
<!-- ServProvId: The same ID for all reports for a single request -->
<ServProvId>YA</ServProvId>
<RefDoc>
<MsgType V="A" DN="Vedlegg"/>
<MimeType>application/pdf</MimeType>
<Description>Svarrapport - pdf</Description>
<Content>
<Base64Container>cmVmCjY3NTcKJSVFT0YK</Base64Container>
</Content>
</RefDoc>
<ServReq>
<!-- IssueDate: request.createdt The time the request was created -->
<IssueDate V="2023-11-13T09:28:00"/>
<Id>20045</Id>
<!-- ReceiptDate: sample.receiveddt - The date and time the sample was received -->
<ReceiptDate V="2023-11-13T11:02:00" />
<!-- IdByServProvider: sample.s_sampleid - The lab's ID -->
<IdByServProvider>23C0017</IdByServProvider>
<ReasonAsText>
<!-- TextResultValue: Request text in (ReasonAsText for Pathology, Comment for Chem/micro) -->
<Heading V="OPPL" DN="Klinisk opplysning"/>
<TextResultValue>Antion</TextResultValue>
</ReasonAsText>
</ServReq>
<Patient>
<Sex V="2" DN="Kvinne"/>
<!-- Name: samplepoint.w_lastname Patient name formatted as lastname, firstname -->
<Name>Lae</Name>
<!-- OffId: samplepoint.w_code -->
<OffId>1900</OffId>
<TypeOffId V="FNR" DN="Fnummer"/>
<AnalysedSubject>
<CollectedSample>
<!-- CollectedDate: sampleitems.collectiondt -->
<CollectedDate V="2023-10-31T09:33:00"/>
</CollectedSample>
<!-- Type: sampleitems.materialdesc Material description or, if is empty, the id. In 1.2 always id -->
<Type>Punktion</Type>
<!-- IdByRequester: sampleitems.pid Requesters id for the sampleitem/analysed subject -->
<IdByRequester>2326501</IdByRequester>
<!-- AnatomicalOrigin: sampleitems.collocid and attr concatenated as needed. The sample location -->
<AnatomicalOrigin>hix glas</AnatomicalOrigin>
<!-- Number: Always 1. Number of sample tubes for this sampleitem/analysed subject. -->
<Number>1</Number>
<!-- IdByServProvider: sampleitems.w_sampleitemid Laboratory unique id for the sampleitem/analysed subject -->
<IdByServProvider>23C-01</IdByServProvider>
</AnalysedSubject>
<AnalysedSubject>
<CollectedSample>
<!-- CollectedDate: sampleitems.collectiondt -->
<CollectedDate V="2023-10-31T09:33:00"/>
</CollectedSample>
<!-- Type: sampleitems.materialdesc Material description or, if is empty, the id. In 1.2 always id -->
<Type>Punktion</Type>
<!-- IdByRequester: sampleitems.pid Requesters id for the sampleitem/analysed subject -->
<IdByRequester>23262</IdByRequester>
<!-- AnatomicalOrigin: sampleitems.collocid and attr concatenated as needed. The sample location -->
<AnatomicalOrigin>h glas</AnatomicalOrigin>
<!-- Number: Always 1. Number of sample tubes for this sampleitem/analysed subject. -->
<Number>1</Number>
<!-- IdByServProvider: sampleitems.w_sampleitemid Laboratory unique id for the sampleitem/analysed subject -->
<IdByServProvider>23C7-02</IdByServProvider>
</AnalysedSubject>
<AnalysedSubject>
<CollectedSample>
<!-- CollectedDate: sampleitems.collectiondt -->
<CollectedDate V="2023-10-31T09:33:00"/>
</CollectedSample>
<!-- Type: sampleitems.materialdesc Material description or, if is empty, the id. In 1.2 always id -->
<Type>Punktion</Type>
<!-- IdByRequester: sampleitems.pid Requesters id for the sampleitem/analysed subject -->
<IdByRequester>2323</IdByRequester>
<!-- AnatomicalOrigin: sampleitems.collocid and attr concatenated as needed. The sample location -->
<AnatomicalOrigin>hyt, TP</AnatomicalOrigin>
<!-- Number: Always 1. Number of sample tubes for this sampleitem/analysed subject. -->
<Number>1</Number>
<!-- IdByServProvider: sampleitems.w_sampleitemid Laboratory unique id for the sampleitem/analysed subject -->
<IdByServProvider>23C17-03</IdByServProvider>
</AnalysedSubject>
<ResultItem>
<ServType V="N" DN="Ny"/>
<Investigation>
<!-- Id: default : Workitem externalcode -->
<Id V="CY02" S="2.16.57" DN=""/>
<!-- Id: Workitem local id -->
<Id V="CAXILL" S="2.16212" OT="CBRÖSTAXILL"/>
<!-- Spec: Workitem idbyrequester (orderid) -->
<Spec V="540875" S="2.16" />
</Investigation>
<InvDate V="2023-11-13T11:04:00"/>
<StatusInvestigation V="3" DN="Endelig"/>
<RelServProv>
<Role V="RSP" DN="Tiyter"/>
<Relation V="ALE" DN="Ans"/>
<HCP>
<HCProf>
<Name>m</Name>
</HCProf>
</HCP>
</RelServProv>
<ResultItem>
<TextResult>
<Heading V="DIAG" DN="Diagnose"/>
<!-- Diagnosis text: text.concsummarytext -->
<TextResultValue>dios</TextResultValue>
<TextCode V="T00" DN="hudumör" S="2.16.578.1.10"/>
</TextResult>
</ResultItem>
<ResultItem>
<!-- Statement text: text.conclusiontext -->
<TextResult>
<TextResultValue>y</TextResultValue>
</TextResult>
<Investigation>
<Id V="MI" S="2.19" DN="Mikroskøkelse"/>
</Investigation>
</ResultItem>
</ResultItem>
</Patient>
<ServProvider>
<HCP>
<!-- Inst:
Department (Dept) is the answerto for Requester element, the laboratory for ServProvider element.
Institution (Inst) is given by the field w_ediorganizationid for the answerto or laboratory in customer table.
If the department (answerto) points to itself in customer table (w_ediorganizationid = w_customerid), then the department element (Dept) is left out.
-->
<Inst>
<!-- Name: rpt_name - reportname, if empty the name, if empty w_customerid -->
<Name></Name>
<!-- Id: rpt_edicode - edicode or if empty, w_customerid -->
<Id>AUM</Id>
<TypeId V="" DN=""/>
<!-- Dept: The answerto or laboratory -->
<Dept>
<!-- Name: rpt_name - reportname, if empty the name, if empty w_customerid -->
<Name>Paogi</Name>
<!-- Id: rpt_edicode - edicode or if empty, w_customerid -->
<Id>MLB</Id>
<TypeId V="" DN=""/>
</Dept>
</Inst>
</HCP>
</ServProvider>
<Requester>
<Role V="REQ" DN="Rekvirent" />
<ComMethod V="EDI" DN="EDI" />
<HCP>
<!-- Inst:
Department (Dept) is the answerto for Requester element, the laboratory for ServProvider element.
Institution (Inst) is given by the field w_ediorganizationid for the answerto or laboratory in customer table.
If the department (answerto) points to itself in customer table (w_ediorganizationid = w_customerid), then the department element (Dept) is left out.
-->
<Inst>
<!-- Name: rpt_name - reportname, if empty the name, if empty w_customerid -->
<Name>MediYd</Name>
<!-- Id: rpt_edicode - edicode or if empty, w_customerid -->
<Id>EVP</Id>
<TypeId V="" DN=""/>
</Inst>
</HCP>
</Requester>
<PaymentResponsible>
<TypeGuarantor>Betaliig</TypeGuarantor>
<HCP>
<!-- Inst:
Department (Dept) is the answerto for Requester element, the laboratory for ServProvider element.
Institution (Inst) is given by the field w_ediorganizationid for the answerto or laboratory in customer table.
If the department (answerto) points to itself in customer table (w_ediorganizationid = w_customerid), then the department element (Dept) is left out.
-->
<Inst>
<!-- Name: rpt_name - reportname, if empty the name, if empty w_customerid -->
<Name>Medicin</Name>
<!-- Id: rpt_edicode - edicode or if empty, w_customerid -->
<Id>YVP</Id>
<TypeId V="" DN=""/>
</Inst>
</HCP>
</PaymentResponsible>
</ServReport>
</Message>
我没有“Biztalk Orchestration Designer”,所以像下面这样的替代方案可能会有所帮助。
当您有 Notepad++ 时,通过 XML 插件,您可以执行以下操作:
Xml 工具/评估 XPath 表达式,表达式为:
//x:Base64Container
或者,第二个选项,表达式:
/x:Message/x:ServReport/x:RefDoc/x:Content/x:Base64Container