Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xml viewer for linux [closed]

Tags:

I want to view large XML files. I tried XML Copy Editor but it displays XML data just in one line means it is not showing it in proper format. I saw screenshots of XML Copy Editor on Google which look quite good.

Does anybody have an idea how do I view XML file in XML Copy Editor in proper format?

Or any other good XML viewer for Ubuntu?

like image 252
Ragini Avatar asked Jun 26 '12 12:06

Ragini


People also ask

How do I view XML files in Linux?

xml file you want to view. If you're using Gnome, you can open GNOME Files and double-click the folder where the file is stored. If you're using KDE, the built-in file manager is Dolphin. Right-click the file and select Open With Other Application.

How do I open an XML viewer?

View an XML file in a browser Just about every browser can open an XML file. In Chrome, just open a new tab and drag the XML file over. Alternatively, right click on the XML file and hover over "Open with" then click "Chrome". When you do, the file will open in a new tab.

Does XML work on Linux?

XML is a markup language that's being used widely to structure and transfer data across the wire. While there are tonnes of libraries and frameworks that allow us to parse and handle XML documents, xmllint is one of the most versatile XML command-line tools in Linux.

What happened to XML Notepad?

The original XML Notepad shipped in back in 1998, written by Murray Low in C++. Later on it fell behind in support for XML standards and, because we didn't have time to fix it, we pulled the downloader.


2 Answers

None of you guys suggesting Emacs, Vim, Geany or other text editor have clearly not worked with enterprise level XML data...

To get a touch with reality please take some averagely complex OpenDocument (Open/Libre Office ".odt" file, preferably with some tables and images) and try to edit that with your Emacs or Vim. Try to create a new with all the required fields pre-filled. Create a new table, or insert a new image. With a good XML editor all you need is "Right click -> Insert".

Unfortunately good XML editors cost money. XMLSpy from Altova is about 1000 U.S. dollars, OxygenXML bit less.

like image 187
Tero Niemi Avatar answered Sep 23 '22 17:09

Tero Niemi


Combining xmllint and less was a great intuition (kudos for @kokosing) and yes, it is possible to have syntax highlighting with less! Here is the full, workable solution:

xmllint --format yourfile | highlight --syntax=xml --out-format=xterm256 | less -R -N 

The trick is to use:

  1. Another utility to do the syntax hightlighting (highlight can do it).
  2. Use the -R (raw) option in less so that it respects the escape sequences; N simply provides line numbering, which is nice.

It worked surprisingly well, so I published the solution on github with a bash script, under the name xmlshow.

Note: Next time you use less, I suggest that you press hto (re-)discover its amazing range of features.

like image 37
fralau Avatar answered Sep 22 '22 17:09

fralau