XML Extract Data

@Beatriz_Eugenia_Duqu

lets introduce an approach which is using datatables for configuring the extraction with the help of XPath:

Readin XML, parse to XObject (Ensure via dependency manager UiPath.WebApi.Acitivities is referenced):

grafik

Build the Extraction Config for the static part and the dynamic (lines) part:
grafik
grafik

add dynamicly the different columns to the extrac Datatable for later holding the extracted values:
grafik

Iterate of the extract config for the statics , extract the value and store it to a datarow (created with dtExtract.NewRow).
grafik

Retrieve all line elements:
grafik

  • iterate now over all line elements
  • create a DataRow (drExtractRow) for holding the extraction result
  • transfer with one go the extraction result of the statics to the drExtractRows
    drExtractRow.ItemArray = drStaticPart.ItemArray (So we can reuse the static part again without multiple redundant extractions)
  • iterate over the extraction config for the dynamics and extract the values
  • finally add drExtractRows to the Datatable dtExtract


grafik

as it was an adoption from here:

with the help of webtools (F12) in Browser the remaining XPath statements can be grabbed:

ensure also following:
grafik

Find starter help here:
StaticDynamicRetrieval_ByXpathConfig.xaml (17.9 KB)

1 Like