Huachao / vscode-restclient

REST Client Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=humao.rest-client
MIT License
5.21k stars 433 forks source link

XML CDATA is not parsed correctly #996

Open edwinm opened 2 years ago

edwinm commented 2 years ago

Steps to Reproduce:

  1. Try this code:
@date = {{rss.response.body.//lastBuildDate[1]}}
@title = {{rss.response.body.//title[1]}}

# @name rss
GET http://feeds.bbci.co.uk/news/rss.xml?edition=uk HTTP/1.1

ACTUAL RESULT:

@date is readable, @title is not.

EXPECTED:

Both @date and @title should contain text from the RSS feed.

BACKGROUND:

@date is plain text and @title is wrapped in a <![CDATA[…]> block.

A CDATA block is a valid XML way to wrap text.

Any XML-parser knows how to handle CDATA.

It's unclear why the REST client fails with CDATA blocks.

Huachao commented 2 years ago

@edwinm could you please also provide the actual xml code blocks with <![CDATA[...]]>

edwinm commented 2 years ago
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/shared/bsp/xsl/rss/nolsol.xsl"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[BBC News - Home]]></title>
        <description><![CDATA[BBC News - Home]]></description>
        <link>https://www.bbc.co.uk/news/</link>
        <image>
            <url>https://news.bbcimg.co.uk/nol/shared/img/bbc_news_120x60.gif</url>
            <title>BBC News - Home</title>
            <link>https://www.bbc.co.uk/news/</link>
        </image>
        <generator>RSS for Node</generator>
        <lastBuildDate>Sun, 03 Jul 2022 21:59:59 GMT</lastBuildDate>
        <copyright><![CDATA[Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/2/hi/help/rss/4498287.stm for terms and conditions of reuse.]]></copyright>
        <language><![CDATA[en-gb]]></language>
        <ttl>15</ttl>
        <item>
            <title><![CDATA[Copenhagen shooting: Danish police cannot rule out terror in mall attack]]></title>
            <description><![CDATA[Shoppers flee in panic after gunfire inside one of the country's biggest shopping centres.]]></description>
            <link>https://www.bbc.co.uk/news/world-europe-62030919?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-europe-62030919</guid>
            <pubDate>Sun, 03 Jul 2022 21:56:57 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Chris Pincher suspension: Boris Johnson unaware of specific claims - minister]]></title>
            <description><![CDATA[Therese Coffey says the ex-Tory MP facing groping allegations was vetted before being promoted.]]></description>
            <link>https://www.bbc.co.uk/news/uk-politics-62029881?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-politics-62029881</guid>
            <pubDate>Sun, 03 Jul 2022 17:29:11 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Covid: UK hospital cases set to rise, says health chief]]></title>
            <description><![CDATA[Dame Jenny Harries says Britons should lead "normal lives" but take precautions as infections go up.]]></description>
            <link>https://www.bbc.co.uk/news/uk-62030083?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-62030083</guid>
            <pubDate>Sun, 03 Jul 2022 17:05:29 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Ukraine confirms Russia captured eastern city Lysychansk]]></title>
            <description><![CDATA[Ukraine says it pulled its troops out and Russia claims to control all of Luhansk region.]]></description>
            <link>https://www.bbc.co.uk/news/world-europe-62030051?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-europe-62030051</guid>
            <pubDate>Sun, 03 Jul 2022 17:27:45 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Wimbledon: Novak Djokovic beats Tim van Rijthoven to set up Jannik Sinner quarter-final]]></title>
            <description><![CDATA[Defending champion Novak Djokovic continues his pursuit of a seventh Wimbledon title as he beats Tim van Rijthoven to reach the quarter-finals.]]></description>
            <link>https://www.bbc.co.uk/sport/tennis/62030164?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/tennis/62030164</guid>
            <pubDate>Sun, 03 Jul 2022 21:55:49 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Sydney floods: Tens of thousands told to evacuate]]></title>
            <description><![CDATA[Downpours and floods cause mass evacuations and at least one death in Australia's largest city.]]></description>
            <link>https://www.bbc.co.uk/news/world-australia-62027248?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-australia-62027248</guid>
            <pubDate>Sun, 03 Jul 2022 12:47:23 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Army's YouTube and Twitter accounts hacked]]></title>
            <description><![CDATA[The British Army says it is investigating after videos and posts for cryptocurrency appeared on its accounts.]]></description>
            <link>https://www.bbc.co.uk/news/uk-62030644?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-62030644</guid>
            <pubDate>Sun, 03 Jul 2022 20:57:28 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[British Grand Prix: Carlos Sainz wins after huge Zhou Guanyu crash]]></title>
            <description><![CDATA[Ferrari's Carlos Sainz takes his first Formula 1 victory at the end of an extraordinary British Grand Prix packed full of incident and drama.]]></description>
            <link>https://www.bbc.co.uk/sport/formula1/62030429?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/formula1/62030429</guid>
            <pubDate>Sun, 03 Jul 2022 16:32:07 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Peter Brook: British stage directing great dies aged 97]]></title>
            <description><![CDATA[His works, featuring theatre's most distinguished names, both enthralled and shocked audiences.]]></description>
            <link>https://www.bbc.co.uk/news/entertainment-arts-12553081?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/entertainment-arts-12553081</guid>
            <pubDate>Sun, 03 Jul 2022 14:09:25 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Egypt: Red Sea beaches close after deadly shark attack]]></title>
            <description><![CDATA[Two women tourists died after being attacked while swimming near the Egyptian city of Hurghada.]]></description>
            <link>https://www.bbc.co.uk/news/world-europe-62029779?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-europe-62029779</guid>
            <pubDate>Sun, 03 Jul 2022 15:04:41 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Firefighters tackle Bromley tower block fire]]></title>
            <description><![CDATA[Residents were evacuated from the 17-storey building as 100 firefighters battled the flames.]]></description>
            <link>https://www.bbc.co.uk/news/uk-england-london-62027621?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-england-london-62027621</guid>
            <pubDate>Sun, 03 Jul 2022 17:18:35 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Police drop probe into Patrick Grady harassment allegations]]></title>
            <description><![CDATA[The Glasgow North MP had been under investigation over claims dating back to 2016.]]></description>
            <link>https://www.bbc.co.uk/news/uk-scotland-scotland-politics-62030355?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-scotland-scotland-politics-62030355</guid>
            <pubDate>Sun, 03 Jul 2022 16:31:13 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Emotional Sue Barker gets Centre Court ovation]]></title>
            <description><![CDATA[Watch Sue Barker receive a standing ovation from the Centre Court crowd after John McEnroe pays an emotional tribute to the BBC presenter.]]></description>
            <link>https://www.bbc.co.uk/sport/av/tennis/62029228?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/av/tennis/62029228</guid>
            <pubDate>Sun, 03 Jul 2022 13:41:42 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[The Railway Children sequel gets premiere at original Yorkshire station]]></title>
            <description><![CDATA[Jenny Agutter and her new co-stars travel to Oakworth, 52 years after the classic film's release.]]></description>
            <link>https://www.bbc.co.uk/news/entertainment-arts-62014506?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/entertainment-arts-62014506</guid>
            <pubDate>Sun, 03 Jul 2022 15:36:21 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA['Drawing doodles for Ant and Dec was my dream job']]></title>
            <description><![CDATA[Katie Abey from Derbyshire illustrated the TV favourites' book about mental health.]]></description>
            <link>https://www.bbc.co.uk/news/uk-england-derbyshire-61868699?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-england-derbyshire-61868699</guid>
            <pubDate>Sat, 02 Jul 2022 23:18:45 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Inside a US abortion clinic in its final days]]></title>
            <description><![CDATA[The BBC spent time with staff before they had to stop work and turn patients away.]]></description>
            <link>https://www.bbc.co.uk/news/world-us-canada-61975857?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-us-canada-61975857</guid>
            <pubDate>Sat, 02 Jul 2022 23:02:14 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[St Paul's Carnival: Scaled-down event honours elders]]></title>
            <description><![CDATA[Instead of the full event, community elders were honoured at St Paul's Carnival in Bristol.]]></description>
            <link>https://www.bbc.co.uk/news/uk-england-bristol-62023355?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-england-bristol-62023355</guid>
            <pubDate>Sun, 03 Jul 2022 12:18:17 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[How much of our plastic 'recycling' is actually recycled?]]></title>
            <description><![CDATA[About 11 million tonnes of plastic waste flows into the ocean each year, the UN says.]]></description>
            <link>https://www.bbc.co.uk/news/science-environment-62013030?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/science-environment-62013030</guid>
            <pubDate>Sat, 02 Jul 2022 23:09:09 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[War in Ukraine: Can we say how many people have died?]]></title>
            <description><![CDATA[Russia and Ukraine have different claims of how many people have died in the conflict. The BBC explores the data.]]></description>
            <link>https://www.bbc.co.uk/news/world-europe-61987945?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-europe-61987945</guid>
            <pubDate>Fri, 01 Jul 2022 10:15:06 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Ukraine: The teachers swapping classrooms for trenches]]></title>
            <description><![CDATA[A number of teachers in Ukraine are educating their students online from the front line.]]></description>
            <link>https://www.bbc.co.uk/news/world-europe-62003180?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-europe-62003180</guid>
            <pubDate>Sat, 02 Jul 2022 23:28:54 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Wimbledon: The 'brutal' world of doubles tennis]]></title>
            <description><![CDATA[Venus Williams and Jamie Murray have taken their first step as a pairing into the "brutal world" of doubles tennis - but what exactly does that entail?]]></description>
            <link>https://www.bbc.co.uk/sport/tennis/62004807?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/tennis/62004807</guid>
            <pubDate>Sat, 02 Jul 2022 18:08:16 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Fighting for rights for workers undergoing fertility treatment]]></title>
            <description><![CDATA[Proposed legislation would require employers to give staff time off work to attend fertility appointments.]]></description>
            <link>https://www.bbc.co.uk/news/business-61999359?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/business-61999359</guid>
            <pubDate>Sat, 02 Jul 2022 23:25:48 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Paris terror attacks: 'I refuse to hate my brother's killers']]></title>
            <description><![CDATA[The sister of the only British victim of the Paris terror attacks reflects on the 10-month trial.]]></description>
            <link>https://www.bbc.co.uk/news/uk-england-essex-62013212?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-england-essex-62013212</guid>
            <pubDate>Sat, 02 Jul 2022 23:35:08 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[The supermarket rows you don't usually hear about]]></title>
            <description><![CDATA[The spat between Heinz and Tesco has shone a light on the challenges facing suppliers and retailers.]]></description>
            <link>https://www.bbc.co.uk/news/business-62011145?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/business-62011145</guid>
            <pubDate>Sat, 02 Jul 2022 23:37:29 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Daphne du Maurier: Novelist who traced past to a French debtors' jail]]></title>
            <description><![CDATA[Rebecca writer Dame Daphne du Maurier discovered her apparent aristocratic past was not as it seemed.]]></description>
            <link>https://www.bbc.co.uk/news/world-europe-61985416?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-europe-61985416</guid>
            <pubDate>Sat, 02 Jul 2022 23:58:40 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[US woman denied termination in Malta: 'I was terrified']]></title>
            <description><![CDATA[Andrea was medically evacuated to Spain as doctors in Malta could not terminate her pregnancy under the country's ban on abortion.]]></description>
            <link>https://www.bbc.co.uk/news/world-61959825?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/world-61959825</guid>
            <pubDate>Sun, 03 Jul 2022 00:04:18 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Wimbledon 2022: Cameron Norrie beats Tommy Paul to reach quarter-finals at All England Club]]></title>
            <description><![CDATA[Cameron Norrie maintains the British challenge in the Wimbledon singles by beating American Tommy Paul to reach his first Grand Slam quarter-final.]]></description>
            <link>https://www.bbc.co.uk/sport/tennis/62030683?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/tennis/62030683</guid>
            <pubDate>Sun, 03 Jul 2022 19:30:44 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[England v India: Jonny Bairstow ton fails to halt tourists]]></title>
            <description><![CDATA[India remain in a dominant position in the fifth Test against England despite another superb century from Jonny Bairstow on day three at Edgbaston.]]></description>
            <link>https://www.bbc.co.uk/sport/cricket/62017731?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/cricket/62017731</guid>
            <pubDate>Sun, 03 Jul 2022 18:29:48 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[India v England: Day three highlights - Bairstow makes another century but India remain in control]]></title>
            <description><![CDATA[Watch highlights of day three at Edgbaston as Jonny Bairstow makes another stunning century.]]></description>
            <link>https://www.bbc.co.uk/sport/av/cricket/62031173?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/av/cricket/62031173</guid>
            <pubDate>Sun, 03 Jul 2022 19:01:52 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[British Grand Prix: Lewis Hamilton backs protests but Mercedes question methods]]></title>
            <description><![CDATA[Leading drivers said they backed the cause of protesters who demonstrated on environmental issues after a track invasion at the British Grand Prix.]]></description>
            <link>https://www.bbc.co.uk/sport/formula1/62030105?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/formula1/62030105</guid>
            <pubDate>Sun, 03 Jul 2022 19:21:11 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Wimbledon: Nick Kyrgios and Stefanos Tsitsipas both fined over conduct]]></title>
            <description><![CDATA[Nick Kyrgios and Stefanos Tsitsipas are fined for their conduct during their fiery third-round match at Wimbledon.]]></description>
            <link>https://www.bbc.co.uk/sport/tennis/62031962?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/tennis/62031962</guid>
            <pubDate>Sun, 03 Jul 2022 21:04:43 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Wimbledon 2022: Marie Bouzkova produces an outrageous bending backhand against Caroline Garcia]]></title>
            <description><![CDATA[Marie Bouzkova produces an outrageous bending backhand against Caroline Garcia to win the best shot of day seven at Wimbledon.]]></description>
            <link>https://www.bbc.co.uk/sport/av/tennis/62030531?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/av/tennis/62030531</guid>
            <pubDate>Sun, 03 Jul 2022 18:01:14 GMT</pubDate>
        </item>
        <item>
            <title><![CDATA[Wimbledon: Jamie Murray and Venus Williams out of mixed doubles]]></title>
            <description><![CDATA[Jamie Murray and Venus Williams are knocked out of the mixed doubles by British wildcards Jonny O'Mara and Alicia Barnett.]]></description>
            <link>https://www.bbc.co.uk/sport/tennis/62029117?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/sport/tennis/62029117</guid>
            <pubDate>Sun, 03 Jul 2022 20:44:13 GMT</pubDate>
        </item>
    </channel>
</rss>