export xml file

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.

Maybe you can find help in XML Filter Settings

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

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.

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.

Just noticed the date :slight_smile: