I have a string representation of an xml line. What is the best method to retrieve the inside node values as strings?
char *str = "<heading>Reminder</heading><body>Don't forget me this weekend!</body>"
The best method depends on complexity of the XML stream you expect. It the string is really that easy as in your example, I would code it manually, with functions like strtok_r or scanf. If you think, that the data structure may become more complex and the nesting will increase, I would use a dedicated library, as proposed before. Further: How much error treatment do you need?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.