| 2011 | // Parse CDATA |
| 2012 | template<int Flags> |
| 2013 | xml_node<Ch> *parse_cdata(Ch *&text) |
| 2014 | { |
| 2015 | // If CDATA is disabled |
| 2016 | if (Flags & parse_no_data_nodes) |
| 2017 | { |
| 2018 | // Skip until end of cdata |
| 2019 | while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>')) |
| 2020 | { |
| 2021 | if (!text[0]) |
| 2022 | CEREAL_RAPIDXML_PARSE_ERROR("unexpected end of data", text); |
| 2023 | ++text; |
| 2024 | } |
| 2025 | text += 3; // Skip ]]> |
| 2026 | return 0; // Do not produce CDATA node |
| 2027 | } |
| 2028 | |
| 2029 | // Skip until end of cdata |
| 2030 | Ch *value_ = text; |
| 2031 | while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>')) |
| 2032 | { |
| 2033 | if (!text[0]) |
| 2034 | CEREAL_RAPIDXML_PARSE_ERROR("unexpected end of data", text); |
| 2035 | ++text; |
| 2036 | } |
| 2037 | |
| 2038 | // Create new cdata node |
| 2039 | xml_node<Ch> *cdata = this->allocate_node(node_cdata); |
| 2040 | cdata->value(value_, static_cast<std::size_t>(text - value_)); |
| 2041 | |
| 2042 | // Place zero terminator after value |
| 2043 | if (!(Flags & parse_no_string_terminators)) |
| 2044 | *text = Ch('\0'); |
| 2045 | |
| 2046 | text += 3; // Skip ]]> |
| 2047 | return cdata; |
| 2048 | } |
| 2049 | |
| 2050 | // Parse element node |
| 2051 | template<int Flags> |
nothing calls this directly
no test coverage detected