0

I am trying to parse xml which has Unicode chars but rapidxml is giving exception when I call parse function.

Attaching code snippet.

Note: Same code is able to parse ascii containt.

bool
ParseXmlData(const std::wstring &XmlData)
{
    LPCTSTR thisMethod = L"ParseXmlData()";
    wchar_t* wc_xmlstring = wcsdup(XmlData.c_str());

    xml_document<wchar_t> xmldoc;

    try
    {
        xmldoc.parse<0>(wc_xmlstring);
    }
    catch (rapidxml::parse_error &e)
    {
        std::cout << e.what()
        free (dupStr);
       return false;
    }

    -
    -
    -
    -
    return true
}
simba
  • 11
  • 8
  • what kind of exception do you get? and what is input value that your are trying to test? – miradham Nov 24 '17 at 08:27
  • I am getting this error : expected ' or " – simba Nov 24 '17 at 08:57
  • I am having Korean character in my xml. You can use this content where my code is failing, < path="\\home\조선글"/> More info at https://en.wikipedia.org/wiki/Hangul – simba Nov 24 '17 at 09:48

1 Answers1

2

I could reproduce your issue with your input, though it is not reproduced with every Korean character. It turns out that rapidxml has bug when parsing characters outside look up table size.

You can find full patch here. I have verified that problem is fixed after applying this patch.
Hope it will be useful.

miradham
  • 2,285
  • 16
  • 26