Mario
Mario

Reputation: 87

Rapidxml reading Cyrillic from COM object

I'm trying to parse XML file which contains Cyrillic letters, and I receive Parse error: "unexpected end of data"

Here is the code that I use to parse, and the catch statement that I enter in.

rapidxml::xml_document<TCHAR> doc;
rapidxml::xml_node<TCHAR>* rootNode;

// Helping in the debug
// std::cout << nElementIndex << std::endl;

const int SIZE = 300;
LPWSTR indirectString = new wchar_t[SIZE];

TCHAR* temp = m_vecContainer[nElementIndex].xml.GetBuffer();

try 
{
    doc.parse<0>(&temp[0]);
}
catch (rapidxml::parse_error &e)
{
    return ERROR_INVALID_FUNCTION;
}

Here is an example what can return xml.GetBuffer() method:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Version>1.3.33.5</Version>
    <Description>Поддържа актуален софтуера ви от Google. Ако тази задача е деактивирана или спряна, софтуерът ви от Google няма да е актуален, което означава, че ако в сигурността възникне уязвимост, тя няма да бъде коригирана и е възможно някои функции да не работят. Тази задача се деинсталира сама, когато няма софтуер от Google, който да я използва.</Description>
    <URI>\GoogleUpdateTaskMachineCore</URI>
  </RegistrationInfo>
...
</Task>

Can someone help me, because I cannot find any useful information on the internet.

Thanks in advance.

Upvotes: -1

Views: 223

Answers (1)

George Dimitriadis
George Dimitriadis

Reputation: 1805

I am not familiar with rapidxml, but a quick search shows that it handles utf8 input by default. So, your problem is not the Cyrillic letters probably. I would focus on the 'unexpected end of data' notice instead and confirm that the XML feed obeys the strict XML rules. Try these tools:

http://www.xmlvalidation.com/
http://www.utilities-online.info/xsdvalidation/#.WSgPG2iGOUk

If your XML is valid, I'm sorry I don't have other clues to help you with.

Good luck !

Upvotes: 0

Related Questions