11

How can one open an XML file, for example with LibreOffice? If I try, all I see is the text format of XML, with tags and so on.

PJTraill
  • 107
Luigi
  • 502

6 Answers6

16

If the file is an XML table, you can open it in LibreOffice Calc through the Data > XML Source menu1. Inside it, you just need to open the XML file, point to the table you're importing on the left column and specify a destination in your sheet in the right text field. Example:

enter image description here

This feature is documented in the Help for LibreOffice Calc and at https://wiki.documentfoundation.org/Development/Calc/XMLSource .

1 Since this is an experimental feature (at least in V 6.1.3.2), it may be unreliable and the menu entry will be greyed out unless experimental features are enabled with ToolsOptionsLibreOfficeAdvancedEnable experimental features.

3

You can also use basex from the software center.

sudo apt-get install basex

BaseX is a very fast and light-weight, yet powerful XML database and XPath/XQuery processor, including support for the latest W3C Full Text and Update Recommendations. It supports large XML instances and offers a highly interactive front-end (basexgui).

I don't have it installed but it has really high ratings from the software center.

Parto
  • 15,647
0

You may find XMLStarlet useful, if you are familiar with XPATH concepts (or prepared to learn them).

This is a command-line tool which can select data from an XML file on the basis of the types of elements and the values of their attributes or those of related elements. I am not sure if it is easy to generate a CSV file or other suitable for loading into LibreOffice (if that is your aim), or whether you would need to transform it a little first. (I shall try to remember to update this if I find out more.)

The examples given in the Wikipedia article (link above) show the command as xml (e.g. xml sel for a selection), but in my case (OpenSuse Leap) it is xmlstarlet, which is also the package to install; I do not know what the situation is for Ubuntu.

PJTraill
  • 107
0

The default Gedit text editor is capable of opening the file - I also suggest you try Bluefish, which can do XML as well HTML and other languages. It also does auto-completion, and highlighting.

Here are examples of the above editors based on this:

Bluefish screenshot

enter image description here N.B. With Gedit, you have to add some of the above by changing a few settings and activating a few plugins.

Wilf
  • 30,732
0

In case you don't succeed with LibreOffice, try using SoftMaker FreeOffice. This free office suite has much better import and export filters that let you run Microsoft Office formats faithfully. The whole office suite is feature-packed, but needs only 58MB. It's well coded, very fast and reliable. Here's the link where to get it:

www.freeoffice.com

0

XML Copy Editor (xmlcopyeditor) is a fast, free, validating XML editor. It features DTD/XML Schema/RELAX NG validation, XSLT, XPath, pretty-printing, syntax highlighting, folding, tag completion/locking, and a spelling/style check. XML Copy Editor can be installed from the default Ubuntu repositories.

XML Copy Editor debugger (xmlcopyeditor-dbg) is an optional add-on for XML Copy Editor that can also be installed from the default Ubuntu repositories.

enter image description here

karel
  • 122,292
  • 133
  • 301
  • 332