Posted: . At: 2:28 PM. This was 2 years ago. Post ID: 16154
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Another very good way to parse an XML RSS feed to plain text.


This solution I found is a very good way to parse an XML RSS feed to plain text. This requires the XMLStarlet utility. On a Macbook it was installed easily.

[ jason@$deusexmachina.local ]
[ Jobs 0. PWD: ~. -bash 3.2.57. ] [ 118-:$ ]
-> brew install xmlstarlet
==> Downloading https://ghcr.io/v2/homebrew/core/xmlstarlet/manifests/1.6.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/xmlstarlet/blobs/sha256:5af39f6a67faf86069e1bf504a000ed321b18ad5d2cf5fe90978dc00fb32c1dd
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:5af39f6a67faf86069e1bf504a000ed321b18ad5d2cf5fe90978dc00fb32c1dd?se=20
######################################################################## 100.0%
==> Pouring xmlstarlet--1.6.1.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/xmlstarlet/1.6.1: 15 files, 229.9KB
==> Running `brew cleanup xmlstarlet`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

After it is installed I was able to use this utility to parse the contents of an XML RSS feed very easily.

[ jason@$deusexmachina.local ]
[ Jobs 0. PWD: ~/Downloads. -bash 3.2.57. ] [ 123-:$ ]
-> xml sel -t -v '//item/title' rss.xml
Man to face court after weekend punch to mouth at Wagga pub
Man charged over alleged knife assault on officer after pursuit, crash
Riverina COVID tally grows by 412, state records three deaths
End of an era: Horseman steps away from rodeo after 44 years
All the key steps and dates now we have an election date
'Game on': Riverina gears up for hotly contested federal election
'Very pleased': Wagga set to bolster climate change response
Man who assaulted neighbour warned over court sentencing outburst
Good signs for Murrumbidgee as COVID case numbers continue to fall
'Remover of obstacles': significance of Fusion's striking sculpture
50-plus photos from Fusion multicultural street festival
Superfans already looking to the future for the next NRL game
Police say missing man, 63, found safe and sound
Canberra Raiders v Melbourne Storm in Wagga |
Community honour for Defence Shed president Jason Frost
Wagga law firm in landmark $6.75m High Court decision
Big decision looms for controversial $25.5 million project
Letters: 'Useless' speed camera signs fuel revenue raising
Raiders fans ready to turn Wagga green for big day of footy
Wagga's top doctors meet to address dire staffing shortages

I am looking for this particular XML.

<item><title>Big decision looms for controversial $25.5 million project</title>

So the ‘//item/title’ parameter for the XMLStarlet utility looks for this particular section of the XML code and then returns the RSS item title.

You may also look for just one XML tag.

[ jason@$deusexmachina.local ]
[ Jobs 0. PWD: ~/Downloads. -bash 3.2.57. ] [ 127-:$ ]
-> xml sel -t -v '//description' rss.xml
Latest Wagga Wagga news, sport, football and business news from The Daily Advertiser.
"We will be keeping a close eye on assaults at licenced premises."
Riverina Police District were patrolling when they attempted to stop a Holden Senator being driven erratically.
NSW Health reported almost 13,500 new cases in the same timeframe, with more than 1500 people now being cared for in hospital.
Pick up man puts down reins.
Prime Minister Scott Morrison has made the iconic trip to Government House in Canberra to see the Governor-General before calling the election. A lot has to happen from here, and the clock is ticking.
The candidates vying for the Riverina's federal seat believe cost of living pressures will be crucial to swaying votes.
Climate conscious residents have had their voices heard by Wagga City Council.
Nicholas John McIntyre attacked a neighbour who complained about him yelling in the street.
The recent downward trend in the region's daily coronavirus cases has continued over the weekend.
Sand sculptor Steve Machell's Ganesha was among the highlights of this year's FUSION22 multicultural festival - possessing significant meaning to both him and those of the Hindu faith.
Take a look through our official gallery for FUSION22 Multicultural Street Festival.
"We're grumpy because Storm are winning, we only have two," she said.
The man had been missing since midday on Friday.
Follow all the action from the NRL game between Canberra Raiders and Melbourne Storm in Wagga.
Wagga MP Joe McGirr presented Jason Frost with the award this week.
Ms Tapp fell from her horse at a campdrafting event and the High Court ruled that the organisers knew there was a risk of serious injury to competitors.
The vote will take place at Council's fortnightly meeting on Monday evening.
A DA reader says mobile speed cameras punish the most minor indiscretions.
Wagga City Council expects this weekend's game to bring an almost $2 million financial boon to the city.
Wagga Base Hospital staffing needs brought to MLHD management Wednesday are in line with recent nurse striking demands.

I am looking for the tag in the XML file and this is easy to do with a proper XML parser. So, this is ideal for parsing an XML RSS file on the command line.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.