XML Parse

Hi guys!
I’m new to XML and would like some help collecting info from an XDoc:

VOO_22.2 FirstNameField ...

“” contains more “” and i’d like to collect the “CDATA” value for each “” based on the “”.

Please help me out :slight_smile:

I don’t understand your requirement @mikamol

Can you explain

<Case xmlns="urn:abou:documents:ka:Case">
  <INum>115123-41231-EV50</INum>
  <DiaryNumber />
  <DateSubmitted>2019-09-11T09:37:22.3070000</DateSubmitted>
  <Fields>
    <Field>
      <Id>VOO_22.2</Id>
      <TypeOfField>FirstNameField</TypeOfField>
      <Question><![CDATA[Förnamn]]></Question>
      <Answer><![CDATA[Filip]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Filip]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>

Here’s the top part of the XDoc…

I need to somehow get the “Answer” -> “CDATA”-value based on the “Id”.

Ex: with key “VOO_22.2” i’d like to get the value “Filip”.

:slight_smile:

XML code was removed from post :confused:

Please post the entire XML of the part of XML with specific structure so that I will try and let you know

<Case xmlns="urn:abou:documents:ka:Case">
  <Id>123-456-789</Id>
  <DiaryNumber />
  <DateSubmitted>2019-09-11T09:37:22.3070000</DateSubmitted>
  <SentInAs>Citizen</SentInAs>
  <RequiresMultipleSignatures>false</RequiresMultipleSignatures>
  <Status>Inkommet</Status>
  <ServiceId>V22</ServiceId>
  <ServiceName>Larm</ServiceName>
  <ServiceVersion>30</ServiceVersion>
  <ServiceStatuses>
    <ServiceStatus>Inkommet</ServiceStatus>
    <ServiceStatus>Registrerat</ServiceStatus>
    <ServiceStatus>Under handläggning</ServiceStatus>
    <ServiceStatus>Avslutat</ServiceStatus>
  </ServiceStatuses>
  <Citizens>
    <Citizen>
      <HasSigned>false</HasSigned>
      <IsCoApplicant>false</IsCoApplicant>
      <UserIdentity>19596206666</UserIdentity>
      <FirstName>Filip</FirstName>
      <LastName>Walldén</LastName>
    </Citizen>
  </Citizens>
  <Signatures />
  <Payments />
  <QueueItems />
  <Fields>
    <Field>
      <Id>VOO_22.2</Id>
      <TypeOfField>FirstNameField</TypeOfField>
      <Question><![CDATA[Förnamn]]></Question>
      <Answer><![CDATA[Filip]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Filip]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.3</Id>
      <TypeOfField>LastNameField</TypeOfField>
      <Question><![CDATA[Efternamn]]></Question>
      <Answer><![CDATA[Walldén]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Walldén]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.4</Id>
      <TypeOfField>AddressField</TypeOfField>
      <Question><![CDATA[Adress]]></Question>
      <Answer><![CDATA[Postal Address]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Postal Address]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.5</Id>
      <TypeOfField>IntegratedPostcodeField</TypeOfField>
      <Question><![CDATA[Postnummer]]></Question>
      <Answer><![CDATA[111 11]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[111 11]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.6</Id>
      <TypeOfField>CityField</TypeOfField>
      <Question><![CDATA[Ort]]></Question>
      <Answer><![CDATA[Big City]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Big City]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.8</Id>
      <TypeOfField>HomePhoneField</TypeOfField>
      <Question><![CDATA[Telefon]]></Question>
      <Answer><![CDATA[1231231231230]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[1231231231230]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.9</Id>
      <TypeOfField>MobilePhoneField</TypeOfField>
      <Question><![CDATA[Mobil]]></Question>
      <Answer><![CDATA[0702110708]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[0702110708]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.11</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Eventuell portkod]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.7</Id>
      <TypeOfField>IntegratedEmailField</TypeOfField>
      <Question><![CDATA[E-post]]></Question>
      <Answer><![CDATA[anton.larsson@lund.se]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[anton.larsson@lund.se]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.12</Id>
      <TypeOfField>EGovRadioButtonField</TypeOfField>
      <Question><![CDATA[Ange anledning till att du vill ha ett trygghetslarm]]></Question>
      <Answer><![CDATA[Jag känner mig otrygg]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Jag känner mig otrygg]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.13</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Annan anledning till att  du vill ha trygghetslarm?]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.14</Id>
      <TypeOfField>EGovRadioButtonField</TypeOfField>
      <Question><![CDATA[Vad vill du uppnå med ditt trygghetslarm?]]></Question>
      <Answer><![CDATA[Jag vill känna mig tryggare]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Jag vill känna mig tryggare]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.15</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Annat]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.16</Id>
      <TypeOfField>EGovCheckBoxField</TypeOfField>
      <Question><![CDATA[Information om ditt hälsotillstånd]]></Question>
      <Answer><![CDATA[Synnedsättning;Hörselnedsättning]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Synnedsättning]]></Text>
          <Value />
        </Answer>
        <Answer>
          <Text><![CDATA[Hörselnedsättning]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.17</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Synnedsättning]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.18</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Hörselnedsättning]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.19</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Förflyttningssvårigheter]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.28</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Yrsel och/eller balanssvårigheter]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.20</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Annat]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.21</Id>
      <TypeOfField>EGovRadioButtonField</TypeOfField>
      <Question><![CDATA[Är ni flera personer i hushållet?]]></Question>
      <Answer><![CDATA[Jag bor själv]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Jag bor själv]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.22</Id>
      <TypeOfField>EGovRadioButtonField</TypeOfField>
      <Question><![CDATA[Har du husdjur?]]></Question>
      <Answer><![CDATA[Nej]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Nej]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.23</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Ange vilka husdjur]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.24</Id>
      <TypeOfField>EGovRadioButtonField</TypeOfField>
      <Question><![CDATA[Vem ska vi kontakta vid installation av trygghetslarmet?]]></Question>
      <Answer><![CDATA[Kontakta mig direkt]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Kontakta mig direkt]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.25</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Namn]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.26</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Telefonnummer]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.29</Id>
      <TypeOfField>EGovRadioButtonField</TypeOfField>
      <Question><![CDATA[Behöver personalen kunna kommunicera med dig på ett annat språk?]]></Question>
      <Answer><![CDATA[Nej]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Nej]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.30</Id>
      <TypeOfField>EGovTextField</TypeOfField>
      <Question><![CDATA[Ange vilket språk]]></Question>
      <Answer><![CDATA[]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
    <Field>
      <Id>VOO_22.27</Id>
      <TypeOfField>EGovCheckBoxField</TypeOfField>
      <Question><![CDATA[]]></Question>
      <Answer><![CDATA[Jag är införstådd med att nycklar till min bostad måste lämnas i samband med installation av trygghetslarmet]]></Answer>
      <Answers>
        <Answer>
          <Text><![CDATA[Jag är införstådd med att nycklar till min bostad måste lämnas i samband med installation av trygghetslarmet]]></Text>
          <Value />
        </Answer>
      </Answers>
      <Arguments />
      <EventType />
    </Field>
  </Fields>
  <Attachments>
    <Attachment>
      <Type>CasePdf</Type>
      <FileName>123456789.pdf</FileName>
      <SystemFileName />
      <FileType>application/pdf</FileType>
      <FileDescription>Billaga</FileDescription>
      <DateUploaded>2019-09-11T09:37:22.3070000</DateUploaded>
      <FileSize>81911</FileSize>
      <Content />
      <FieldId />
      <Arguments />
    </Attachment>
  </Attachments>
</Case>

Need to get the “Answer”-CDATA based on the Field Id

Hi @mikamol
Find the attached sample Main.xaml (8.1 KB)
that is showcasing following:

  • Retrieving all Field elements
  • Retrieving all Id elements (Parent is Field)
  • Retrieving the particular Answer Value for a particular Id

As this XML is defining the namespace:` xmlns="urn:abou:documents:ka:Case
The Root element Name is not Case it is: e.g. urn:abou:documents:ka:Case:Case
So the namespace part is to take into account
Solved with using namespace manager

Kindly note the order from a XML Document returned Sequence is not mandatory position safe. In the log output you will some entries on different positions

1 Like