Rapidxml cannot read Atom feed ? - Element XMLNS unbound

Flaviu_ 1,031 Reputation points
2023-06-28T08:45:10.9166667+00:00

I have the following test xml:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:ht='https://google.com' version='2.0'>
    <channel>
        <atom:link href='https://google.com' rel='self' type='application/rss+xml'/>
        <item>
            <title>Microsoft</title>
            <ht:valaue>440</ht:valaue>
            <description></description>
            <link>https://google.com</link>
            <Date>Tue, 27 Jun 2023 03:00:00 +0300</Date>
            <ht:item>
                <ht:title>Learn Xml</ht:title>
                <ht:url>
                <ht:source>Akama</ht:source>
            </ht:item>
        </item>
    </channel>
</rss>

And I have tried to validate it with (simplified):

rapidxml::xml_document<> doc;

CStdioFile file;
if (! file.Open(_T("C:\\Home\\Temp\\new.xml"), CFile::modeRead | CFile::typeText))
    throw std::runtime_error("Error: Cannot open xml file");

CString sText, sLine;
while (file.ReadString(sLine))
    sText.Append(sLine + _T("\n"));
doc.parse<0>(CT2A(sText));
doc.validate();

The issue is I always got: Element XMLNS unbound. How can I overcome this issue ? Rapidxml library cannot read this kind of xml ?

Developer technologies XAML
{count} votes

1 answer

Sort by: Most helpful
  1. Flaviu_ 1,031 Reputation points
    2023-06-28T12:34:20.7466667+00:00

    If I read the xml file using std::ifstream the issue dissapear.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.