RapidXML giving empty CDATA nodes

后端 未结 1 1831
情深已故
情深已故 2021-01-19 14:24

I wrote the code bellow to get CDATA node value too, I got the node\'s name, but the values are in blank.

I changed the parse Flags to parse_full, but it not worked

相关标签:
1条回答
  • 2021-01-19 15:14

    When you use CDATA, RapidXML parses that as a separate node 'below' the outer element in the hierarchy.

    Your code correctly gets 'title' by using nodeFrame->first_node()->name(), but - because the CDATA text is in a separate element, you'd need to use this to extract the value:

    cout << "value: " <<nodeFrame->first_node()->first_node()->value();

    0 讨论(0)
提交回复
热议问题