Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-27-2008, 11:01 AM   #1
LQ Newbie
Registered: Sep 2008
Location: South East England
Distribution: Red Hat
Posts: 11

Rep: Reputation: 0
Question Is there an XML-manipulation tool for Linux?

Dear All,

I have received an XML document that I need to process and then output in a user-readable format. Does anyone know of a Linux XML-manipulation tool that I can use with shell script?


Old 11-27-2008, 12:24 PM   #2
Registered: Dec 2007
Location: Slightly left of center
Distribution: slackware
Posts: 276
Blog Entries: 2

Rep: Reputation: 44
Depending on how complex the XML code is, and just how much info you want to extract, there are several options.

The simplest method is, of course, to use a shell regular expression to grab the text between whatever XML tags you wish to display or save, and perhaps parse out and handle or delete any embedded tags in that text. I use that method to convert XML RSS feeds to plain text.

On the other end of the scale, some folks have created bash extensions for the expat XML library, a web search should show you examples. Some of them are overly complex and arcane, in my opinion, but take that with a grain of salt, it is only an opinion.
Old 11-27-2008, 06:54 PM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.7, Centos 5.10
Posts: 16,917

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Perl has several XML modules eg,
Old 11-28-2008, 01:45 AM   #4
Registered: Jul 2008
Posts: 159

Rep: Reputation: 31
Originally Posted by QuietLeni View Post
I have received an XML document that I need to process and then output in a user-readable format.
If this means pretty-printing XML, then xmllint might be suitable.
Old 11-30-2008, 05:11 AM   #5
Senior Member
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,475
Blog Entries: 23

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346


If it is well-behaved XML - IE well formed, you should be able to simply open/view it with your webbrowser. Double-click the file, I bet the browser will start up and display the text...
My reasoning? If it is prinable XML, it has to have an accompanying DTD file that dictates how the browser (or indeed any XMLcapable piece of software) has to display the data...

If not, then the XML could "belong" to some receicing software. As with many settings, software saves these a XML, without the DTD, as the data needs no displaying...




shell, xml

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mal-format xml checking tool ufmale Programming 1 09-05-2008 01:50 PM
LXer: Subtitle manipulation tools for Linux LXer Syndicated Linux News 0 02-07-2008 08:30 PM
Linux Text Manipulation Question resolute155 Programming 2 01-02-2007 06:48 PM
Linux folder and file manipulation help resolute155 Programming 4 12-20-2006 11:32 AM
C File Manipulation in Linux drigz Programming 5 10-01-2004 08:28 AM

All times are GMT -5. The time now is 07:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration