How can I xpath a value from an xml <Any> element?

126 views Asked by At

In my Biztalk Orchestration designer (Expression editor) I need to extract the value from the element called <Any>. I created a string variable and did an xpath on the field but the variable results in null.

The element is named "Base64Container" in my xml file.

This is the 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']");

The problem is with this part:

  /*[local-name()='Base64Container']");

How can extract the value from the element, that is named Base64Container in my xml?

Here is my xml file:

<?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>

Here is my schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns:kith="http://www.kith.no/xmlstds" xmlns:lsr="http://www.kith.no/xmlstds/labsvar/2012-02-15" targetNamespace="http://www.kith.no/xmlstds/labsvar/2012-02-15" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <import schemaLocation="kith.xsd" namespace="http://www.kith.no/xmlstds"/>
    <!-- Class: Svarrapportmelding -->
    <element name="Message">
        <complexType>
            <sequence>
                <element name="Type" type="kith:CS"/>
                <element name="MsgVersion" type="kith:ST" minOccurs="0"/>
                <element name="MIGversion" type="kith:ST"/>
                <element name="GenDate" type="kith:TS"/>
                <element name="MsgId" type="kith:ST"/>
                <element name="Status" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:ServReport" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Svarrapport -->
    <element name="ServReport">
        <complexType>
            <sequence>
                <element name="ServType" type="kith:CS"/>
                <element name="IssueDate" type="kith:TS"/>
                <element name="ApprDate" type="kith:TS" minOccurs="0"/>
                <element name="Status" type="kith:CS"/>
                <element name="CancellationCode" type="kith:CV" minOccurs="0"/>
                <element name="Ack" type="kith:CS" minOccurs="0"/>
                <element name="MsgDescr" type="kith:CS"/>
                <element name="ServProvId" type="kith:ST"/>
                <element name="Comment" type="kith:ST" minOccurs="0"/>
                <element name="CodedComment" type="kith:CV" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:RefDoc" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:ServReq" minOccurs="0" maxOccurs="unbounded"/>
                <choice>
                    <element ref="lsr:Patient" minOccurs="0"/>
                    <element ref="lsr:Animal" minOccurs="0"/>
                    <element ref="lsr:Material" minOccurs="0"/>
                </choice>
                <element ref="lsr:ServProvider"/>
                <element ref="lsr:Requester"/>
                <element ref="lsr:PaymentResponsible" minOccurs="0"/>
                <element ref="lsr:CopyDest" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:RelServProv" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Rekvisisjon -->
    <element name="ServReq">
        <complexType>
            <sequence>
                <element name="ServType" type="kith:CS" minOccurs="0"/>
                <element name="IssueDate" type="kith:TS" minOccurs="0"/>
                <element name="PaymentCat" type="kith:CS" minOccurs="0"/>
                <element name="ReqComment" type="kith:ST" minOccurs="0"/>
                <element name="Ack" type="kith:CS" minOccurs="0"/>
                <element name="MsgDescr" type="kith:CS" minOccurs="0"/>
                <element name="Id" type="kith:ST"/>
                <element name="RequestedPrioReport" type="kith:CS" minOccurs="0"/>
                <element name="ReceiptDate" type="kith:TS" minOccurs="0"/>
                <element name="IdByServProvider" type="kith:ST" minOccurs="0"/>
                <element name="Reservation" type="kith:CV" minOccurs="0" maxOccurs="unbounded"/>
                <!-- Tatt bort element Permission i versjon 1.4 da dette aldri har vært dokumentert eller i bruk
                <element name="Permission" type="kith:CV" minOccurs="0" maxOccurs="unbounded"/>
                -->
                <element ref="lsr:ReasonAsText" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:Comment" minOccurs="0" maxOccurs="unbounded"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Kommentar til rekvisisjon -->
    <element name="Comment">
        <complexType>
            <sequence>
                <element name="Heading" type="kith:CS" minOccurs="0"/>
                <element name="TextResultValue" type="kith:ST" minOccurs="0"/>
                <element name="TextCode" type="kith:CV" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Begrunnelse for rekvisisjon -->
    <element name="ReasonAsText">
        <complexType>
            <sequence>
                <element name="Heading" type="kith:CS" minOccurs="0"/>
                <element name="TextResultValue" type="anyType" minOccurs="0"/>
                <element name="TextCode" type="kith:CV" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Tjenesteyter -->
    <element name="ServProvider">
        <complexType>
            <sequence>
                <element name="Role" type="kith:CS" minOccurs="0"/>
                <element name="ComMethod" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:HCP"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Referert dokument -->
    <element name="RefDoc">
        <complexType>
            <sequence>
                <element name="IssueDate" type="kith:TS" minOccurs="0"/>
                <element name="MsgType" type="kith:CS"/>
                <element name="Id" type="string" minOccurs="0"/>
                <element name="MimeType" type="string" minOccurs="0"/>
                <element name="Description" type="string" minOccurs="0"/>
                <element name="Compression" type="kith:CS" minOccurs="0"/>
                <choice>
                    <element name="FileReference" type="anyURI" minOccurs="0"/>
                    <element name="Content" minOccurs="0">
                        <complexType>
                            <complexContent>
                                <restriction base="anyType">
                                    <sequence>
                                        <any processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
                                    </sequence>
                                </restriction>
                            </complexContent>
                        </complexType>
                    </element>
                </choice>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Pasient -->
    <element name="Patient">
        <complexType>
            <sequence>
                <element name="BasisForHealthServices" type="kith:CS" minOccurs="0"/>
                <element name="Sex" type="kith:CS" minOccurs="0"/>
                <element name="DateOfBirth" type="kith:TS" minOccurs="0"/>
                <element name="DateOfDeath" type="kith:TS" minOccurs="0"/>
                <element name="Name" type="kith:ST" minOccurs="0"/>
                <element name="IdByServProvider" type="kith:ST" minOccurs="0"/>
                <element name="IdByRequester" type="kith:ST" minOccurs="0"/>
                <element name="OffId" type="kith:ST"/>
                <element name="TypeOffId" type="kith:CS"/>
                <element name="Relation" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:ResponsibleHcp" minOccurs="0"/>
                <element ref="lsr:AdmLocation" minOccurs="0"/>
                <element ref="lsr:AdditionalId" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:Address" minOccurs="0"/>
                <element ref="lsr:InfItem" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:AnalysedSubject" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:ResultItem" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:Patient" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Materiale -->
    <element name="Material">
        <complexType>
            <sequence>
                <element name="InvMaterial" type="kith:ST" minOccurs="0"/>
                <element name="IdByServProvider" type="kith:ST" minOccurs="0"/>
                <element name="IdByRequester" type="kith:ST" minOccurs="0"/>
                <element name="Relation" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:ResponsibleHcp" minOccurs="0"/>
                <element ref="lsr:AnalysedSubject" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:ResultItem" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:Material" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Dyr -->
    <element name="Animal">
        <complexType>
            <sequence>
                <element name="Sex" type="kith:CS" minOccurs="0"/>
                <element name="Name" type="kith:ST" minOccurs="0"/>
                <element name="NameOwner" type="kith:ST" minOccurs="0"/>
                <element name="Species" type="kith:ST" minOccurs="0"/>
                <element name="IdByServProvider" type="kith:ST" minOccurs="0"/>
                <element name="IdByRequester" type="kith:ST" minOccurs="0"/>
                <element name="Relation" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:ResponsibleHcp" minOccurs="0"/>
                <element ref="lsr:AnalysedSubject" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:ResultItem" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:Animal" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Betalingsansvarlig -->
    <element name="PaymentResponsible">
        <complexType>
            <sequence>
                <element name="Role" type="kith:CS" minOccurs="0"/>
                <element name="TypeGuarantor" type="kith:ST"/>
                <element ref="lsr:HCP"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Kopimottaker -->
    <element name="CopyDest">
        <complexType>
            <sequence>
                <element name="Role" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:CopyDestRole" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:HCP"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Henvisende instans -->
    <element name="Requester">
        <complexType>
            <sequence>
                <element name="Role" type="kith:CS" minOccurs="0"/>
                <element name="ComMethod" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:HCP"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Alternativ pasientid -->
    <element name="AdditionalId">
        <complexType>
            <sequence>
                <element name="Id" type="kith:ST"/>
                <element name="Type" type="kith:CS"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Kopimottakerrolle -->
    <element name="CopyDestRole">
        <complexType>
            <sequence>
                <element name="MsgType" type="kith:CS"/>
                <element name="ReqComMethod" type="kith:CS" minOccurs="0"/>
                <element name="ActComMethod" type="kith:CS" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Oppholdssted -->
    <element name="AdmLocation">
        <complexType>
            <sequence>
                <element name="Role" type="kith:CS" minOccurs="0"/>
                <element name="StartDateTime" type="kith:TS" minOccurs="0"/>
                <element name="EndDateTime" type="kith:TS" minOccurs="0"/>
                <element name="AdmCat" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:Location"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Ansvarlig Helsetjenesteenhet -->
    <element name="ResponsibleHcp">
        <complexType>
            <sequence>
                <element name="Role" type="kith:CS" minOccurs="0"/>
                <element name="Relation" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:HCP"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Klinisk opplysning -->
    <element name="InfItem">
        <complexType>
            <sequence>
                <element ref="lsr:Observation"/>
                <element name="Type" type="kith:CS"/>
                <element name="StartDateTime" type="kith:TS" minOccurs="0"/>
                <element name="EndDateTime" type="kith:TS" minOccurs="0"/>
                <element name="OrgDate" type="kith:TS" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Undersøkelse -->
    <element name="Investigation">
        <complexType>
            <sequence>
                <element name="Id" type="kith:CV" maxOccurs="unbounded"/>
                <element name="Spec" type="kith:CV" minOccurs="0" maxOccurs="unbounded"/>
                <element name="Comment" type="kith:ST" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Forbehandling -->
    <element name="Pretreatment">
        <complexType>
            <sequence>
                <element name="Heading" type="kith:CS" minOccurs="0"/>
                <element name="TextResultValue" type="kith:ST" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Undersøkelsesresultat -->
    <element name="ResultItem">
        <complexType>
            <sequence>
                <choice minOccurs="0">
                    <element ref="lsr:TextResult"/>
                    <element ref="lsr:Interval"/>
                    <element ref="lsr:DateResult"/>
                    <element ref="lsr:NumResult"/>
                </choice>
                <element name="ServType" type="kith:CS" minOccurs="0"/>
                <element ref="lsr:RefInterval" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:Investigation" minOccurs="0" maxOccurs="unbounded"/>
                <element name="InvDate" type="kith:TS" minOccurs="0"/>
                <element name="Comment" type="kith:ST" minOccurs="0"/>
                <element name="DevResultInd" type="kith:CS" minOccurs="0"/>
                <element name="IdResultItem" type="kith:ST" minOccurs="0"/>
                <element name="RefIdResultItem" type="kith:ST" minOccurs="0"/>
                <element name="StatusInvestigation" type="kith:CS" minOccurs="0"/>
                <element name="StatusChangeDate" type="kith:TS" minOccurs="0"/>
                <element name="DescrDate" type="kith:TS" minOccurs="0"/>
                <element name="CounterSignDate" type="kith:TS" minOccurs="0"/>
                <element name="MedicalValidationDate" type="kith:TS" minOccurs="0"/>
                <element name="RefAnalysedSubject" type="kith:ST" minOccurs="0" maxOccurs="unbounded"/>
                <element name="Accredited" type="kith:BL" minOccurs="0"/>
                <element ref="lsr:RelServProv" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:DiagComment" minOccurs="0"/>
                <element ref="lsr:StructuredInfo" minOccurs="0" maxOccurs="unbounded"/>
                <element ref="lsr:ResultItem" minOccurs="0" maxOccurs="unbounded"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Tekstlig resultat -->
    <element name="TextResult">
        <complexType>
            <sequence>
                <element name="Heading" type="kith:CS" minOccurs="0"/>
                <element name="TextResultValue" type="anyType" minOccurs="0"/>
                <element name="TextCode" type="kith:CV" minOccurs="0" maxOccurs="unbounded"/>
                <element name="Unit" type="kith:ST" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Usikkerhetsintervall -->
    <element name="Interval">
        <complexType>
            <sequence>
                <element name="Low" type="kith:PQ" minOccurs="0"/>
                <element name="High" type="kith:PQ" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Datoresultat -->
    <element name="DateResult">
        <complexType>
            <sequence>
                <element name="DateResultValue" type="kith:TS"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Numerisk resultat -->
    <element name="NumResult">
        <complexType>
            <sequence>
                <element name="ArithmeticComp" type="kith:CS" minOccurs="0"/>
                <element name="NumResultValue" type="kith:PQNll"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Referansegrense -->
    <element name="RefInterval">
        <complexType>
            <sequence>
                <element name="Descr" type="kith:ST" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Analysert objekt -->
    <element name="AnalysedSubject">
        <complexType>
            <sequence>
                <choice minOccurs="0">
                    <element ref="lsr:CollectedSample"/>
                    <element ref="lsr:CollectedStudyProduct"/>
                </choice>
                <element name="ServType" type="kith:CS" minOccurs="0"/>
                <element name="Type" type="kith:ST" minOccurs="0"/>
                <element name="TypeCoded" type="kith:CV" minOccurs="0"/>
                <element name="IdByRequester" type="kith:ST" minOccurs="0"/>
                <element name="PreservMaterial" type="kith:ST" minOccurs="0"/>
                <element name="Comment" type="kith:ST" minOccurs="0"/>
                <element name="AnatomicalOrigin" type="kith:ST" minOccurs="0"/>
                <element name="Number" type="kith:INT" minOccurs="0"/>
                <element name="SampleCollInd" type="kith:CS" minOccurs="0"/>
                <element name="SampleCollProc" type="kith:CV" minOccurs="0"/>
                <element name="SampleHandling" type="kith:ST" minOccurs="0" maxOccurs="unbounded"/>
                <element name="IdByServProvider" type="kith:ST"/>
                <element name="Accredited" type="kith:BL" minOccurs="0"/>
                <element ref="lsr:AnalysedSubject" minOccurs="0"/>
                <element ref="lsr:Pretreatment" minOccurs="0"/>
                <element ref="lsr:RelServProv" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Adresse -->
    <element name="Address">
        <complexType>
            <sequence>
                <element name="Type" type="kith:CS"/>
                <element name="StreetAdr" type="kith:ST" minOccurs="0"/>
                <element name="PostalCode" type="kith:ST" minOccurs="0"/>
                <element name="City" type="kith:ST" minOccurs="0"/>
                <element name="County" type="kith:CS" minOccurs="0"/>
                <element name="Country" type="kith:CS" minOccurs="0"/>
                <element name="CityDistr" type="kith:CS" minOccurs="0"/>
                <element name="TeleAddress" type="kith:URL" minOccurs="0" maxOccurs="unbounded"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Annen klinisk opplysning -->
    <element name="Observation">
        <complexType>
            <sequence>
                <element name="Description" type="anyType" minOccurs="0"/>
                <element name="Comment" type="kith:ST" minOccurs="0"/>
                <element name="CodedDescr" type="kith:CV" minOccurs="0"/>
            </sequence>
        </complexType>
    </element>
    <!-- Class: Tatt prøve -->
    <element name="CollectedSample">
        <complexType>
            <sequence>
                <element name="CollectedDate" type="kith:TS" minOccurs="0"/>
                <element name="CollectorComment" type="kith:ST" minOccurs="0"/>
                <element name="CollectorCommentCoded" type="kith:CV" minOccurs="0" maxOccurs="unbounded"/>
                <element name="Logistics" type="kith:ST" minOccurs="0"/>
            </sequence>
        </complexType>
           .........................
    </element>
</xmlschema>
    
2

There are 2 answers

6
Dijkgraaf On

I tried the XPath in your example with the XML in a tool called DanSharp Xml Viewer and it correctly returned the node. DanSharp XML Viewer returning the node

What you are missing is probably converting it to a string, as per Using XPaths in Message Assignments, e.g.

vMyVariable = xpath(mKithResult.mmpBody, "string(/*[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']");

DanSharp XML Viewer returning the value

0
Luuk On

I do not have "Biztalk Orchestration designer", so an alternative like below might help.

When you have Notepad++, with the XML plugin, you can do:

Xml Tools/Evaluate XPath expression, with expression: //x:Base64Container

enter image description here

Or, second option, with expression: /x:Message/x:ServReport/x:RefDoc/x:Content/x:Base64Container

enter image description here

or (after this answer): /*[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']

enter image description here