zach-m / jonix

Commercial-grade library for extracting data from ONIX sources
Apache License 2.0
57 stars 17 forks source link

Add ability to export data from Java class structure #1

Open aparod opened 9 years ago

aparod commented 9 years ago

I started using this library hoping to be able to read an ONIX file into Java, make changes, then output my changes to a different file. Jonix makes the first two tasks easy, but there seems to be no support for exporting data directly from the Java classes. I would like to be able to do something like this:

File outputFile = new File("/path/to/output/file.xml");
PrintStream printStream = new PrintStream(outputFile);

ONIXWriter onixWriter = new ONIXWriter(header, product); // or maybe an ONIXMessage
onixWriter.setOnixVersion(3);
onixWriter.setOutputFormat("xml"); // Or JSON, CSV, etc
onixWriter.setPrintStream(printStream);
onixWriter.write();
zach-m commented 9 years ago

Hi Adam Exporting back to XML is not something i've seen much demand for. and therefore never included it in my roadmap. Nevertheless, it isn't too difficult to implement. I might be adding it soon.. Regards Zach

On 21 בספט׳ 2015, at 20:11, Adam Parod notifications@github.com wrote:

I started using this library hoping to be able to read an ONIX file into Java, make changes, then output my changes to a different file. Jonix makes the first two tasks easy, but there seems to be no support for exporting data directly from the Java classes. I would like to be able to do something like this:

File outputFile = new File("/path/to/output/file.xml"); PrintStream printStream = new PrintStream(outputFile);

ONIXWriter onixWriter = new ONIXWriter(header, product); // or maybe an ONIXMessage onixWriter.setOnixVersion(3); onixWriter.setOutputFormat("xml"); // Or JSON, CSV, etc onixWriter.setPrintStream(printStream); onixWriter.write(); — Reply to this email directly or view it on GitHub.

BuddhaOhneHals commented 2 years ago

Hi Zach, thank you for the library and your work!

I have to convert an ONIX 2 format into ONIX 3 and wanted to use your library for that. Is it possible to convert a Onix2-Product (or a BaseProduct) into a Onix3-Product and then somehow generate the XML for the product?

Thanks and best regards, Timo