MCPcopy Create free account
hub / github.com/cinience/RedisStudio / parse_node_contents

Method parse_node_contents

include/rapidxml/rapidxml.hpp:2167–2233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2165 // Parse contents of the node - children, data etc.
2166 template<int Flags>
2167 void parse_node_contents(Ch *&text, xml_node<Ch> *node)
2168 {
2169 // For all children and text
2170 while (1)
2171 {
2172 // Skip whitespace between > and node contents
2173 Ch *contents_start = text; // Store start of node contents before whitespace is skipped
2174 skip<whitespace_pred, Flags>(text);
2175 Ch next_char = *text;
2176
2177 // After data nodes, instead of continuing the loop, control jumps here.
2178 // This is because zero termination inside parse_and_append_data() function
2179 // would wreak havoc with the above code.
2180 // Also, skipping whitespace after data nodes is unnecessary.
2181 after_data_node:
2182
2183 // Determine what comes next: node closing, child node, data node, or 0?
2184 switch (next_char)
2185 {
2186
2187 // Node closing or child node
2188 case Ch('<'):
2189 if (text[1] == Ch('/'))
2190 {
2191 // Node closing
2192 text += 2; // Skip '</'
2193 if (Flags & parse_validate_closing_tags)
2194 {
2195 // Skip and validate closing tag name
2196 Ch *closing_name = text;
2197 skip<node_name_pred, Flags>(text);
2198 if (!internal::compare(node->name(), node->name_size(), closing_name, text - closing_name, true))
2199 RAPIDXML_PARSE_ERROR("invalid closing tag name", text);
2200 }
2201 else
2202 {
2203 // No validation, just skip name
2204 skip<node_name_pred, Flags>(text);
2205 }
2206 // Skip remaining whitespace after node name
2207 skip<whitespace_pred, Flags>(text);
2208 if (*text != Ch('>'))
2209 RAPIDXML_PARSE_ERROR("expected >", text);
2210 ++text; // Skip '>'
2211 return; // Node closed, finished parsing contents
2212 }
2213 else
2214 {
2215 // Child node
2216 ++text; // Skip '<'
2217 if (xml_node<Ch> *child = parse_node<Flags>(text))
2218 node->append_node(child);
2219 }
2220 break;
2221
2222 // End of data - error
2223 case Ch('\0'):
2224 RAPIDXML_PARSE_ERROR("unexpected end of data", text);

Callers

nothing calls this directly

Calls 4

compareFunction · 0.85
nameMethod · 0.80
name_sizeMethod · 0.80
append_nodeMethod · 0.80

Tested by

no test coverage detected