Ask Your Question

export xml file

asked 2017-12-19 07:42:36 +0200

clintonwp gravatar image

I'm switching from OpenOffice to LibreOffice. Almost everything I know about databases has been gleaned from the internet so my knowledge is very patchy, and I need answers in simple English please.

I need to generate an XML file from a collection of data (tables or spreadsheets), preferably a relational database which I'll create.

Is there an "elegant" way to do this?

In OpenOffice Base I have used a Select statement to achieve this (conditionally wrapping the xml tags around items from tables), but then needing to import into a spreadsheet, save as csv, open in a reader app, replace tabs with carriage returns, and so on.

I've also tried doing it as a Mail Merge scenario but it is also very messy.

I reckon there must be something I just haven't discovered yet, because this scenario seems such a basic thing for a database (or other) to be able to do.

Within reason, I'm capable of doing a basic level of programming I think this task should require.

I'd very much appreciate a point in the right direction, before I spend a lot of time researching many possibilities.

So far it appears to me that I'm going to have to write an export filter. Is there a simpler solution?

Thanks in advance.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2019-12-24 21:20:37 +0200

Hello @clintonwp

Assuming the export data can be represented as a plain spreadsheet table without any multidimensional includes (which looks is true as you mentioned csv format), such can be done using native LibreOffice tools only and no programming:

  1. Create database according to your needs and wishes
  2. Register it
  3. Create a query to get the data needed
  4. Create a Calc .ods spreadsheet file for importing this data
  5. Import query result
  6. Create an XSLT filter for export. Important caveat regarding the way LO processes data while saving. Also here and here
  7. Save an .xml file using XSLT filter

Once done, later you can easily refresh import data range in spreadsheet using Data -> Refresh range and save .xml with new data once again. Refreshing and saving tasks can be automated and scheduled, so you can always keep .xml file up to date.

If it sounds like acceptable solution - give a go, make some test file and see the result.

If you need an advanced multidimensional xml structure and some custom tuning, you can consider programming approach, using existing xml processing libraries for the coding language of your choice.

edit flag offensive delete link more


Just noticed the date :)

SM_Riga gravatar imageSM_Riga ( 2019-12-24 21:25:32 +0200 )edit

answered 2019-12-23 18:19:19 +0200

Hey Since there is no utility build in LO to export to XML, I suppose the best way is to take a copy of the destination-file (for header-infos and structure) and to rebuild it within the LO-report-builder and do a print-out to text-file. Let us hear if this had worked. mh.

edit flag offensive delete link more

answered 2017-12-19 22:56:32 +0200

m.a.riosv gravatar image

Maybe you can find help in XML Filter Settings

edit flag offensive delete link more


My query is about what direction I need to take, rather than how to do it :)

clintonwp gravatar imageclintonwp ( 2017-12-19 23:39:39 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-12-19 07:42:36 +0200

Seen: 2,074 times

Last updated: Dec 24 '19