CSV to XML

Started by thope@ozemail.com.au, April 08, 2019, 07:01:46 AM

Previous topic - Next topic

thope@ozemail.com.au

Hi All,

I am trying to write a javascript that can be run in Archi, to directly input and change values in the model's XML.
I am not sure if such a feat is possible within Archi and was hoping someone could tell me, or suggest an alternative.
I've been looking at using JQuery to write from CSV into XML but i believe this does not work in Archi.

The larger scope is: I have a csv File that I wish to read data from, take specific data from the csv file and write it into an existing model on Archi.

Cheers,
Roman
Regards Tom
PraXtice makes Perfect
https://praxtice.com.au/

Phil Beauvoir

#1
I think you have two options, depending on the form of data you have.

(1) You can import and update a model with csv if the csv is in the correct csv format. So you would need to get your csv data into this format. More details in the Archi User Guide.

(2) It's also possible to update/modify a model using jArchi. This would entail writing a script in JavaScript to (a) read the csv file (b) parse it (c) cherry pick the data and modify a model with this data.

Phil
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Jean-Baptiste Sarrodie

If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

thope@ozemail.com.au

Thank you for all your replies,

I have been looking at option two from Phil, as it seems to be more closely aligned with what i've been trying to do.
I've looked into the example given by JB, where the user looks like its using papa parse to extract from a csv into a new csv file format,
which is half of what I need. However, I', still unsure if I can inject the extracted csv data into an existing model's XML.

I guess my question is, how do I modify a model's XML using javascript.

Cheers,
Roman
Regards Tom
PraXtice makes Perfect
https://praxtice.com.au/

Jean-Baptiste Sarrodie

Hi,

You do not modify le XML, you edit the model itself in memory using jArchi's API (or through CSV import). Then you simply generate your report. In this (automated) process no XML file is created because you never save the model in the native format.

Regards

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Stanley

Hi

Is there a way to massively update and delete elements and its relationships in a waterfall way with jArchi on the XML?

Best regards,

Jean-Baptiste Sarrodie

Hi,

You can do almost whatever you want with jArchi. You can have a look at its API: https://github.com/archimatetool/archi-scripting-plugin/wiki

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.