XPath selection type

Hi everyone,
pretty newbie in Knime, I’m trying to get from a public url classified informations from an xml file.It works pretty well, to collect all the “marches” (main node) but it becomes tricky as in the file sometime we can get several titulaire_id in the same “marche”, also we may find several “modifications” blocks into the same “marche” …


To resolve the pb of several titulaire_id into the same marche, I created 2 distinct XPath, but not sure if the “modifications” nodes are well managed … any examples of the same kind of case would be much appreciated thank you very much. Here is the workflow :

Hi @jmderay welcome to the KNIME forum!

Would it possible for you to share the XML in text form? What is displayed in the screenshot would be enough.

In the meantime you can have a look at workflows with the XPath node from the KNIME Hub.

Best,
Temesgen

2 Likes

Thank you very much Temesgen for your reply, the case with several titulaires_id seems ok but I still have a problem when there is the cas of several “modifications” xml nodes in a same “marche”
here is an example :

<?xml version="1.0" encoding="UTF-8"?> 201918N0853-0102 20003019500115201918N0853-0102 20003019500115 METROPOLE NICE COTE D'AZUR Marché subséquent FDJ - MS17 - AFFICHES-FLYERS - 1 79800000-2 Appel d'offres ouvert 06364 Code postal NICE CEDEX 4 12 2019-06-14+02:00 2019-06-20+02:00 30000.0000 Ferme SIRET 38980525000021 NIS PHOTOFFSET Modification montants/durée no1 suite à l'avenant de modification de montants no3 2020-05-11+02:00 33000.0000 Modification titulaire no1 suite à l'avenant de transfert no1 2019-08-14+02:00 2019-08-14+02:00 SIRET 95780347100052 GROUPE PERFECTA IMPRIMIX

thanks
JM

Hi JM,

The XML you shared is truncated.

It is better to extract the “modifications” nodes in a separate node (in the same way as you did for titulaires) as the count of children from of this two nodes are not the same. Meaning you can have 10 titulaires but just 1 modifications

May be the attached workflow gives you some Ideas.
.xml_extraction.knwf (25.2 KB)

Hope this helps!
Temesgen

Hi Temesgen,
thanks alot for your infos, but it’s not clear to me how to use your workflow, as I also need to get some other infos from the différents marchés (event though only titulaires et modifications can be multiple). It’s OK to handle the multiple titulaires ID, but I still have little problem with the modifications (especially if there are 2 modifications, some infos are not on the right row, but 1 row above …) Thanks for your help
Have a nice day

Hi Temesgen
your approach seems great and I applied it to my case, but still not resolved … pls see attached workflow where I use the right source (public URL) … the extract individual titulaires seems OK (when I have several titulaires it works), but still not proper in case of several modifications … if you run the attached workflow you’ll see that firt rows in the list are good cases : row0_1_ … has 2 titulaires (it works) …but row0_2_… both modifications are set on the same output result (doesn’t comply the right date)…
Also in the marchés I will need more datas than titulaires and modifications so not sure when to collect those other infos …
Not far from the expected goal but not 100% OK :slight_smile:xml_extraction.knwf (13.9 KB)
Thanks alot for your help

1 Like

Hi finally the following workflow gives the expedted results with another approach.XML.knwf (35.9 KB)
Thanks anyway for your investigations
JM

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.