1 #ifndef RAPIDXML_HPP_INCLUDED 2 #define RAPIDXML_HPP_INCLUDED 10 #if !defined(RAPIDXML_NO_STDLIB) 20 #pragma warning(disable:4127) // Conditional expression is constant 26 #if defined(RAPIDXML_NO_EXCEPTIONS) 28 #define RAPIDXML_PARSE_ERROR(what, where) { parse_error_handler(what, where); assert(0); } 48 void parse_error_handler(
const char *what,
void *where);
55 #define RAPIDXML_PARSE_ERROR(what, where) throw parse_error(what, where) 85 virtual const char *
what()
const throw()
override 96 return reinterpret_cast<Ch *
>(m_where);
112 #ifndef RAPIDXML_STATIC_POOL_SIZE 116 #define RAPIDXML_STATIC_POOL_SIZE (64 * 1024) 119 #ifndef RAPIDXML_DYNAMIC_POOL_SIZE 123 #define RAPIDXML_DYNAMIC_POOL_SIZE (64 * 1024) 126 #ifndef RAPIDXML_ALIGNMENT 131 #define RAPIDXML_ALIGNMENT sizeof(void *) 163 const int parse_no_data_nodes = 0x1;
172 const int parse_no_element_values = 0x2;
179 const int parse_no_string_terminators = 0x4;
186 const int parse_no_entity_translation = 0x8;
193 const int parse_no_utf8 = 0x10;
200 const int parse_declaration_node = 0x20;
207 const int parse_comment_nodes = 0x40;
215 const int parse_doctype_node = 0x80;
222 const int parse_pi_nodes = 0x100;
230 const int parse_validate_closing_tags = 0x200;
238 const int parse_trim_whitespace = 0x400;
247 const int parse_normalize_whitespace = 0x800;
259 const int parse_default = 0;
269 const int parse_non_destructive = parse_no_string_terminators | parse_no_entity_translation;
274 const int parse_fastest = parse_non_destructive | parse_no_data_nodes;
280 const int parse_full = parse_declaration_node | parse_comment_nodes | parse_doctype_node | parse_pi_nodes | parse_validate_closing_tags;
294 static const unsigned char lookup_whitespace[256];
295 static const unsigned char lookup_node_name[256];
296 static const unsigned char lookup_text[256];
297 static const unsigned char lookup_text_pure_no_ws[256];
298 static const unsigned char lookup_text_pure_with_ws[256];
299 static const unsigned char lookup_attribute_name[256];
300 static const unsigned char lookup_attribute_data_1[256];
301 static const unsigned char lookup_attribute_data_1_pure[256];
302 static const unsigned char lookup_attribute_data_2[256];
303 static const unsigned char lookup_attribute_data_2_pure[256];
304 static const unsigned char lookup_digits[256];
305 static const unsigned char lookup_upcase[256];
310 inline std::size_t measure(
const Ch *p)
320 inline bool compare(
const Ch *p1, std::size_t size1,
const Ch *p2, std::size_t size2,
bool case_sensitive)
326 for (
const Ch *end = p1 + size1; p1 < end; ++p1, ++p2)
332 for (
const Ch *end = p1 + size1; p1 < end; ++p1, ++p2)
333 if (lookup_tables<0>::lookup_upcase[static_cast<unsigned char>(*p1)] != lookup_tables<0>::lookup_upcase[static_cast<unsigned char>(*p2)])
378 template<
class Ch =
char>
385 typedef void *(alloc_func)(std::size_t);
386 typedef void (free_func)(
void *);
391 : m_alloc_func(nullptr)
392 , m_free_func(nullptr)
416 const Ch *name = 0,
const Ch *
value = 0,
417 std::size_t name_size = 0, std::size_t value_size = 0)
424 node->
name(name, name_size);
431 node->value(
value, value_size);
448 std::size_t name_size = 0, std::size_t value_size = 0)
455 attribute->
name(name, name_size);
457 attribute->name(name);
462 attribute->value(
value, value_size);
464 attribute->value(
value);
478 assert(source || size);
480 size = internal::measure(source) + 1;
481 Ch *result =
static_cast<Ch *
>(allocate_aligned(size *
sizeof(Ch)));
483 for (std::size_t i = 0; i < size; ++i)
484 result[i] = source[i];
502 result->remove_all_attributes();
503 result->remove_all_nodes();
504 result->type(source->
type());
507 result = allocate_node(source->
type());
515 result->append_node(clone_node(child));
517 result->append_attribute(allocate_attribute(attr->name(), attr->value(), attr->name_size(), attr->value_size()));
527 while (m_begin != m_static_memory)
529 char *previous_begin =
reinterpret_cast<header *
>(
align(m_begin))->previous_begin;
531 m_free_func(m_begin);
534 m_begin = previous_begin;
554 assert(m_begin == m_static_memory && m_ptr ==
align(m_begin));
563 char *previous_begin;
568 m_begin = m_static_memory;
569 m_ptr =
align(m_begin);
570 m_end = m_static_memory +
sizeof(m_static_memory);
573 char *
align(
char *ptr)
575 std::size_t alignment = ((RAPIDXML_ALIGNMENT - (std::size_t(ptr) & (RAPIDXML_ALIGNMENT - 1))) & (RAPIDXML_ALIGNMENT - 1));
576 return ptr + alignment;
579 char *allocate_raw(std::size_t size)
585 memory = m_alloc_func(size);
590 memory =
new char[size];
591 #ifdef RAPIDXML_NO_EXCEPTIONS 593 RAPIDXML_PARSE_ERROR(
"out of memory", 0);
596 return static_cast<char *
>(memory);
599 void *allocate_aligned(std::size_t size)
602 char *result =
align(m_ptr);
605 if (result + size > m_end)
608 std::size_t pool_size = RAPIDXML_DYNAMIC_POOL_SIZE;
609 if (pool_size < size)
613 std::size_t alloc_size =
sizeof(header) + (2 * RAPIDXML_ALIGNMENT - 2) + pool_size;
614 char *raw_memory = allocate_raw(alloc_size);
617 char *pool =
align(raw_memory);
618 header *new_header =
reinterpret_cast<header *
>(pool);
619 new_header->previous_begin = m_begin;
620 m_begin = raw_memory;
621 m_ptr = pool +
sizeof(header);
622 m_end = raw_memory + alloc_size;
625 result =
align(m_ptr);
629 m_ptr = result + size;
636 char m_static_memory[RAPIDXML_STATIC_POOL_SIZE];
637 alloc_func *m_alloc_func;
638 free_func *m_free_func;
647 template<
class Ch =
char>
675 return m_name ? m_name : nullstr();
683 return m_name ? m_name_size : 0;
694 return m_value ? m_value : nullstr();
702 return m_value ? m_value_size : 0;
721 void name(
const Ch *name, std::size_t size)
723 m_name =
const_cast<Ch *
>(name);
732 this->name(name, internal::measure(name));
753 m_value =
const_cast<Ch *
>(value);
762 this->value(value, internal::measure(value));
780 static Ch zero = Ch(
'\0');
786 std::size_t m_name_size;
787 std::size_t m_value_size;
797 template<
class Ch =
char>
823 while (node->parent())
824 node = node->parent();
825 return node->type() == node_document ?
static_cast<xml_document<Ch> *
>(node) : 0;
841 name_size = internal::measure(name);
842 for (
xml_attribute<Ch> *attribute = m_prev_attribute; attribute; attribute = attribute->m_prev_attribute)
843 if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
848 return this->m_parent ? m_prev_attribute : 0;
861 name_size = internal::measure(name);
862 for (
xml_attribute<Ch> *attribute = m_next_attribute; attribute; attribute = attribute->m_next_attribute)
863 if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
868 return this->m_parent ? m_next_attribute : 0;
889 template<
class Ch =
char>
904 , m_first_attribute(0)
941 name_size = internal::measure(name);
943 if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive))
960 assert(m_first_node);
964 name_size = internal::measure(name);
966 if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive))
983 assert(this->m_parent);
987 name_size = internal::measure(name);
988 for (
xml_node<Ch> *sibling = m_prev_sibling; sibling; sibling = sibling->m_prev_sibling)
989 if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive))
994 return m_prev_sibling;
1006 assert(this->m_parent);
1010 name_size = internal::measure(name);
1011 for (
xml_node<Ch> *sibling = m_next_sibling; sibling; sibling = sibling->m_next_sibling)
1012 if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive))
1017 return m_next_sibling;
1030 name_size = internal::measure(name);
1031 for (
xml_attribute<Ch> *attribute = m_first_attribute; attribute; attribute = attribute->m_next_attribute)
1032 if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
1037 return m_first_attribute;
1050 name_size = internal::measure(name);
1051 for (
xml_attribute<Ch> *attribute = m_last_attribute; attribute; attribute = attribute->m_prev_attribute)
1052 if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
1057 return m_first_attribute ? m_last_attribute : 0;
1078 assert(child && !child->
parent() && child->
type() != node_document);
1081 child->m_next_sibling = m_first_node;
1082 m_first_node->m_prev_sibling = child;
1086 child->m_next_sibling = 0;
1087 m_last_node = child;
1089 m_first_node = child;
1090 child->m_parent =
this;
1091 child->m_prev_sibling = 0;
1099 assert(child && !child->
parent() && child->
type() != node_document);
1102 child->m_prev_sibling = m_last_node;
1103 m_last_node->m_next_sibling = child;
1107 child->m_prev_sibling = 0;
1108 m_first_node = child;
1110 m_last_node = child;
1111 child->m_parent =
this;
1112 child->m_next_sibling = 0;
1121 assert(!where || where->
parent() ==
this);
1122 assert(child && !child->
parent() && child->
type() != node_document);
1123 if (where == m_first_node)
1124 prepend_node(child);
1125 else if (where == 0)
1129 child->m_prev_sibling = where->m_prev_sibling;
1130 child->m_next_sibling =
where;
1131 where->m_prev_sibling->m_next_sibling = child;
1132 where->m_prev_sibling = child;
1133 child->m_parent =
this;
1142 assert(first_node());
1144 m_first_node = child->m_next_sibling;
1145 if (child->m_next_sibling)
1146 child->m_next_sibling->m_prev_sibling = 0;
1149 child->m_parent = 0;
1157 assert(first_node());
1159 if (child->m_prev_sibling)
1161 m_last_node = child->m_prev_sibling;
1162 child->m_prev_sibling->m_next_sibling = 0;
1166 child->m_parent = 0;
1173 assert(where && where->
parent() ==
this);
1174 assert(first_node());
1175 if (where == m_first_node)
1176 remove_first_node();
1177 else if (where == m_last_node)
1181 where->m_prev_sibling->m_next_sibling = where->m_next_sibling;
1182 where->m_next_sibling->m_prev_sibling = where->m_prev_sibling;
1183 where->m_parent = 0;
1190 for (
xml_node<Ch> *node = first_node(); node; node = node->m_next_sibling)
1199 assert(attribute && !attribute->
parent());
1200 if (first_attribute())
1202 attribute->m_next_attribute = m_first_attribute;
1203 m_first_attribute->m_prev_attribute = attribute;
1207 attribute->m_next_attribute = 0;
1208 m_last_attribute = attribute;
1210 m_first_attribute = attribute;
1211 attribute->m_parent =
this;
1212 attribute->m_prev_attribute = 0;
1219 assert(attribute && !attribute->
parent());
1220 if (first_attribute())
1222 attribute->m_prev_attribute = m_last_attribute;
1223 m_last_attribute->m_next_attribute = attribute;
1227 attribute->m_prev_attribute = 0;
1228 m_first_attribute = attribute;
1230 m_last_attribute = attribute;
1231 attribute->m_parent =
this;
1232 attribute->m_next_attribute = 0;
1241 assert(!where || where->
parent() ==
this);
1242 assert(attribute && !attribute->
parent());
1243 if (where == m_first_attribute)
1244 prepend_attribute(attribute);
1245 else if (where == 0)
1246 append_attribute(attribute);
1249 attribute->m_prev_attribute = where->m_prev_attribute;
1250 attribute->m_next_attribute =
where;
1251 where->m_prev_attribute->m_next_attribute = attribute;
1252 where->m_prev_attribute = attribute;
1253 attribute->m_parent =
this;
1262 assert(first_attribute());
1264 if (attribute->m_next_attribute)
1266 attribute->m_next_attribute->m_prev_attribute = 0;
1269 m_last_attribute = 0;
1270 attribute->m_parent = 0;
1271 m_first_attribute = attribute->m_next_attribute;
1279 assert(first_attribute());
1281 if (attribute->m_prev_attribute)
1283 attribute->m_prev_attribute->m_next_attribute = 0;
1284 m_last_attribute = attribute->m_prev_attribute;
1287 m_first_attribute = 0;
1288 attribute->m_parent = 0;
1295 assert(first_attribute() && where->
parent() ==
this);
1296 if (where == m_first_attribute)
1297 remove_first_attribute();
1298 else if (where == m_last_attribute)
1299 remove_last_attribute();
1302 where->m_prev_attribute->m_next_attribute = where->m_next_attribute;
1303 where->m_next_attribute->m_prev_attribute = where->m_prev_attribute;
1304 where->m_parent = 0;
1311 for (
xml_attribute<Ch> *attribute = first_attribute(); attribute; attribute = attribute->m_next_attribute)
1312 attribute->m_parent = 0;
1313 m_first_attribute = 0;
1357 template<
class Ch =
char>
1386 this->remove_all_nodes();
1387 this->remove_all_attributes();
1390 parse_bom<Flags>(text);
1396 skip<whitespace_pred, Flags>(text);
1401 if (*text == Ch(
'<'))
1405 this->append_node(node);
1408 RAPIDXML_PARSE_ERROR(
"expected <", text);
1417 this->remove_all_nodes();
1418 this->remove_all_attributes();
1428 struct whitespace_pred
1430 static unsigned char test(Ch ch)
1432 return internal::lookup_tables<0>::lookup_whitespace[
static_cast<unsigned char>(ch)];
1437 struct node_name_pred
1439 static unsigned char test(Ch ch)
1441 return internal::lookup_tables<0>::lookup_node_name[
static_cast<unsigned char>(ch)];
1446 struct attribute_name_pred
1448 static unsigned char test(Ch ch)
1450 return internal::lookup_tables<0>::lookup_attribute_name[
static_cast<unsigned char>(ch)];
1457 static unsigned char test(Ch ch)
1459 return internal::lookup_tables<0>::lookup_text[
static_cast<unsigned char>(ch)];
1464 struct text_pure_no_ws_pred
1466 static unsigned char test(Ch ch)
1468 return internal::lookup_tables<0>::lookup_text_pure_no_ws[
static_cast<unsigned char>(ch)];
1473 struct text_pure_with_ws_pred
1475 static unsigned char test(Ch ch)
1477 return internal::lookup_tables<0>::lookup_text_pure_with_ws[
static_cast<unsigned char>(ch)];
1483 struct attribute_value_pred
1485 static unsigned char test(Ch ch)
1487 if (Quote == Ch(
'\''))
1488 return internal::lookup_tables<0>::lookup_attribute_data_1[
static_cast<unsigned char>(ch)];
1489 if (Quote == Ch(
'\"'))
1490 return internal::lookup_tables<0>::lookup_attribute_data_2[static_cast<unsigned char>(ch)];
1497 struct attribute_value_pure_pred
1499 static unsigned char test(Ch ch)
1501 if (Quote == Ch(
'\''))
1502 return internal::lookup_tables<0>::lookup_attribute_data_1_pure[
static_cast<unsigned char>(ch)];
1503 if (Quote == Ch(
'\"'))
1504 return internal::lookup_tables<0>::lookup_attribute_data_2_pure[static_cast<unsigned char>(ch)];
1511 static void insert_coded_character(Ch *&text,
unsigned long code)
1513 if (Flags & parse_no_utf8)
1517 text[0] =
static_cast<unsigned char>(code);
1525 text[0] =
static_cast<unsigned char>(code);
1528 else if (code < 0x800)
1530 text[1] =
static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
1531 text[0] =
static_cast<unsigned char>(code | 0xC0);
1534 else if (code < 0x10000)
1536 text[2] =
static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
1537 text[1] =
static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
1538 text[0] =
static_cast<unsigned char>(code | 0xE0);
1541 else if (code < 0x110000)
1543 text[3] =
static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
1544 text[2] =
static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
1545 text[1] =
static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
1546 text[0] =
static_cast<unsigned char>(code | 0xF0);
1551 RAPIDXML_PARSE_ERROR(
"invalid numeric character entity", text);
1557 template<
class StopPred,
int Flags>
1558 static void skip(Ch *&text)
1561 while (StopPred::test(*tmp))
1569 template<
class StopPred,
class StopPredPure,
int Flags>
1570 static Ch *skip_and_expand_character_refs(Ch *&text)
1573 if (Flags & parse_no_entity_translation &&
1574 !(Flags & parse_normalize_whitespace) &&
1575 !(Flags & parse_trim_whitespace))
1577 skip<StopPred, Flags>(text);
1582 skip<StopPredPure, Flags>(text);
1587 while (StopPred::test(*src))
1590 if (!(Flags & parse_no_entity_translation))
1593 if (src[0] == Ch(
'&'))
1600 if (src[2] == Ch(
'm') && src[3] == Ch(
'p') && src[4] == Ch(
';'))
1607 if (src[2] == Ch(
'p') && src[3] == Ch(
'o') && src[4] == Ch(
's') && src[5] == Ch(
';'))
1618 if (src[2] == Ch(
'u') && src[3] == Ch(
'o') && src[4] == Ch(
't') && src[5] == Ch(
';'))
1629 if (src[2] == Ch(
't') && src[3] == Ch(
';'))
1640 if (src[2] == Ch(
't') && src[3] == Ch(
';'))
1651 if (src[2] == Ch(
'x'))
1653 unsigned long code = 0;
1657 unsigned char digit = internal::lookup_tables<0>::lookup_digits[
static_cast<unsigned char>(*src)];
1660 code = code * 16 + digit;
1663 insert_coded_character<Flags>(dest, code);
1667 unsigned long code = 0;
1671 unsigned char digit = internal::lookup_tables<0>::lookup_digits[
static_cast<unsigned char>(*src)];
1674 code = code * 10 + digit;
1677 insert_coded_character<Flags>(dest, code);
1679 if (*src == Ch(
';'))
1682 RAPIDXML_PARSE_ERROR(
"expected ;", src);
1695 if (Flags & parse_normalize_whitespace)
1698 if (whitespace_pred::test(*src))
1700 *dest = Ch(
' '); ++dest;
1703 while (whitespace_pred::test(*src))
1725 void parse_bom(Ch *&text)
1728 if (static_cast<unsigned char>(text[0]) == 0xEF &&
1729 static_cast<unsigned char>(text[1]) == 0xBB &&
1730 static_cast<unsigned char>(text[2]) == 0xBF)
1741 if (!(Flags & parse_declaration_node))
1744 while (text[0] != Ch(
'?') || text[1] != Ch(
'>'))
1747 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
1755 xml_node<Ch> *declaration = this->allocate_node(node_declaration);
1758 skip<whitespace_pred, Flags>(text);
1761 parse_node_attributes<Flags>(text, declaration);
1764 if (text[0] != Ch(
'?') || text[1] != Ch(
'>'))
1765 RAPIDXML_PARSE_ERROR(
"expected ?>", text);
1776 if (!(Flags & parse_comment_nodes))
1779 while (text[0] != Ch(
'-') || text[1] != Ch(
'-') || text[2] != Ch(
'>'))
1782 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
1793 while (text[0] != Ch(
'-') || text[1] != Ch(
'-') || text[2] != Ch(
'>'))
1796 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
1801 xml_node<Ch> *comment = this->allocate_node(node_comment);
1802 comment->
value(value, text - value);
1805 if (!(Flags & parse_no_string_terminators))
1820 while (*text != Ch(
'>'))
1836 case Ch(
'['): ++depth;
break;
1837 case Ch(
']'): --depth;
break;
1838 case 0: RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
1847 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
1857 if (Flags & parse_doctype_node)
1860 xml_node<Ch> *doctype = this->allocate_node(node_doctype);
1861 doctype->
value(value, text - value);
1864 if (!(Flags & parse_no_string_terminators))
1883 if (Flags & parse_pi_nodes)
1890 skip<node_name_pred, Flags>(text);
1892 RAPIDXML_PARSE_ERROR(
"expected PI target", text);
1893 pi->
name(name, text - name);
1896 skip<whitespace_pred, Flags>(text);
1902 while (text[0] != Ch(
'?') || text[1] != Ch(
'>'))
1904 if (*text == Ch(
'\0'))
1905 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
1910 pi->
value(value, text - value);
1913 if (!(Flags & parse_no_string_terminators))
1925 while (text[0] != Ch(
'?') || text[1] != Ch(
'>'))
1927 if (*text == Ch(
'\0'))
1928 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
1940 Ch parse_and_append_data(
xml_node<Ch> *node, Ch *&text, Ch *contents_start)
1943 if (!(Flags & parse_trim_whitespace))
1944 text = contents_start;
1947 Ch *
value = text, *end;
1948 if (Flags & parse_normalize_whitespace)
1949 end = skip_and_expand_character_refs<text_pred, text_pure_with_ws_pred, Flags>(text);
1951 end = skip_and_expand_character_refs<text_pred, text_pure_no_ws_pred, Flags>(text);
1954 if (Flags & parse_trim_whitespace)
1956 if (Flags & parse_normalize_whitespace)
1959 if (*(end - 1) == Ch(
' '))
1965 while (whitespace_pred::test(*(end - 1)))
1972 if (!(Flags & parse_no_data_nodes))
1975 data->
value(value, end - value);
1980 if (!(Flags & parse_no_element_values))
1981 if (*node->
value() == Ch(
'\0'))
1982 node->
value(value, end - value);
1985 if (!(Flags & parse_no_string_terminators))
2001 if (Flags & parse_no_data_nodes)
2004 while (text[0] != Ch(
']') || text[1] != Ch(
']') || text[2] != Ch(
'>'))
2007 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
2016 while (text[0] != Ch(
']') || text[1] != Ch(
']') || text[2] != Ch(
'>'))
2019 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
2025 cdata->
value(value, text - value);
2028 if (!(Flags & parse_no_string_terminators))
2040 xml_node<Ch> *element = this->allocate_node(node_element);
2044 skip<node_name_pred, Flags>(text);
2046 RAPIDXML_PARSE_ERROR(
"expected element name", text);
2047 element->
name(name, text - name);
2050 skip<whitespace_pred, Flags>(text);
2053 parse_node_attributes<Flags>(text, element);
2056 if (*text == Ch(
'>'))
2059 parse_node_contents<Flags>(text, element);
2061 else if (*text == Ch(
'/'))
2064 if (*text != Ch(
'>'))
2065 RAPIDXML_PARSE_ERROR(
"expected >", text);
2069 RAPIDXML_PARSE_ERROR(
"expected >", text);
2072 if (!(Flags & parse_no_string_terminators))
2090 return parse_element<Flags>(text);
2095 if ((text[0] == Ch(
'x') || text[0] == Ch(
'X')) &&
2096 (text[1] == Ch(
'm') || text[1] == Ch(
'M')) &&
2097 (text[2] == Ch(
'l') || text[2] == Ch(
'L')) &&
2098 whitespace_pred::test(text[3]))
2102 return parse_xml_declaration<Flags>(text);
2107 return parse_pi<Flags>(text);
2119 if (text[2] == Ch(
'-'))
2123 return parse_comment<Flags>(text);
2129 if (text[2] == Ch(
'C') && text[3] == Ch(
'D') && text[4] == Ch(
'A') &&
2130 text[5] == Ch(
'T') && text[6] == Ch(
'A') && text[7] == Ch(
'['))
2134 return parse_cdata<Flags>(text);
2140 if (text[2] == Ch(
'O') && text[3] == Ch(
'C') && text[4] == Ch(
'T') &&
2141 text[5] == Ch(
'Y') && text[6] == Ch(
'P') && text[7] == Ch(
'E') &&
2142 whitespace_pred::test(text[8]))
2146 return parse_doctype<Flags>(text);
2153 while (*text != Ch(
'>'))
2156 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
2167 void parse_node_contents(Ch *&text,
xml_node<Ch> *node)
2173 Ch *contents_start = text;
2174 skip<whitespace_pred, Flags>(text);
2175 Ch next_char = *text;
2189 if (text[1] == Ch(
'/'))
2193 if (Flags & parse_validate_closing_tags)
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);
2204 skip<node_name_pred, Flags>(text);
2207 skip<whitespace_pred, Flags>(text);
2208 if (*text != Ch(
'>'))
2209 RAPIDXML_PARSE_ERROR(
"expected >", text);
2224 RAPIDXML_PARSE_ERROR(
"unexpected end of data", text);
2228 next_char = parse_and_append_data<Flags>(node, text, contents_start);
2229 goto after_data_node;
2237 void parse_node_attributes(Ch *&text,
xml_node<Ch> *node)
2240 while (attribute_name_pred::test(*text))
2245 skip<attribute_name_pred, Flags>(text);
2247 RAPIDXML_PARSE_ERROR(
"expected attribute name", name);
2251 attribute->
name(name, text - name);
2255 skip<whitespace_pred, Flags>(text);
2258 if (*text != Ch(
'='))
2259 RAPIDXML_PARSE_ERROR(
"expected =", text);
2263 if (!(Flags & parse_no_string_terminators))
2267 skip<whitespace_pred, Flags>(text);
2271 if (quote != Ch(
'\'') && quote != Ch(
'"'))
2272 RAPIDXML_PARSE_ERROR(
"expected ' or \"", text);
2276 Ch *
value = text, *end;
2277 const int AttFlags = Flags & ~parse_normalize_whitespace;
2278 if (quote == Ch(
'\''))
2279 end = skip_and_expand_character_refs<attribute_value_pred<Ch(
'\'')>, attribute_value_pure_pred<Ch('\'')>, AttFlags>(text);
2281 end = skip_and_expand_character_refs<attribute_value_pred<Ch(
'"')>, attribute_value_pure_pred<Ch(
'"')>, AttFlags>(text);
2284 attribute->
value(value, end - value);
2288 RAPIDXML_PARSE_ERROR(
"expected ' or \"", text);
2292 if (!(Flags & parse_no_string_terminators))
2296 skip<whitespace_pred, Flags>(text);
2308 const unsigned char lookup_tables<Dummy>::lookup_whitespace[256] =
2311 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
2312 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2313 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2314 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2315 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2316 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2321 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
2354 const unsigned char lookup_tables<Dummy>::lookup_text[256] =
2357 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2358 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2359 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2360 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
2361 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2362 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2363 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2364 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2365 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2366 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2367 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2368 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2369 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2370 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2371 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2372 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
2378 const unsigned char lookup_tables<Dummy>::lookup_text_pure_no_ws[256] =
2381 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2382 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
2494 const unsigned char lookup_tables<Dummy>::lookup_attribute_data_2[256] =
2497 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2498 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2499 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2500 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2501 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2502 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2503 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2504 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2505 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2506 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2507 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2508 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2509 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2510 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2511 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2512 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
2517 const unsigned char lookup_tables<Dummy>::lookup_attribute_data_2_pure[256] =
2520 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2521 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2522 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2523 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2524 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2525 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2526 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2527 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2528 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2529 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2530 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2531 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2532 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2533 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2534 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2535 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
2540 const unsigned char lookup_tables<Dummy>::lookup_digits[256] =
2543 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2544 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2545 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2546 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,255,255,255,255,255,255,
2547 255, 10, 11, 12, 13, 14, 15,255,255,255,255,255,255,255,255,255,
2548 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2549 255, 10, 11, 12, 13, 14, 15,255,255,255,255,255,255,255,255,255,
2550 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2551 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2552 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2553 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2554 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2555 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2556 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2557 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
2558 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
2563 const unsigned char lookup_tables<Dummy>::lookup_upcase[256] =
2566 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2567 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
2568 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
2569 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
2570 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2571 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2572 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2573 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123,124,125,126,127,
2574 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
2575 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
2576 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
2577 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
2578 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
2579 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
2580 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
2581 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
2589 #undef RAPIDXML_PARSE_ERROR 2593 #pragma warning(pop) xml_node< Ch > * parent() const
Gets node parent.
Definition: rapidxml.hpp:770
xml_node< Ch > * clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0)
Clones an xml_node and its hierarchy of child nodes and attributes.
Definition: rapidxml.hpp:497
void clear()
Clears the pool.
Definition: rapidxml.hpp:525
xml_node(node_type type)
Constructs an empty node with the specified type.
Definition: rapidxml.hpp:901
void clear()
Clears the document by deleting all nodes and clearing the memory pool.
Definition: rapidxml.hpp:1415
void name(const Ch *name, std::size_t size)
Sets name of node to a non zero-terminated string.
Definition: rapidxml.hpp:721
std::size_t name_size() const
Gets size of node name, not including terminator character.
Definition: rapidxml.hpp:681
Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent().
Definition: rapidxml.hpp:648
void prepend_attribute(xml_attribute< Ch > *attribute)
Prepends a new attribute to the node.
Definition: rapidxml.hpp:1197
xml_document< Ch > * document() const
Gets document of which node is a child.
Definition: rapidxml.hpp:923
void value(const Ch *value, std::size_t size)
Sets value of node to a non zero-terminated string.
Definition: rapidxml.hpp:751
Ch * allocate_string(const Ch *source=0, std::size_t size=0)
Allocates a char array of given size from the pool, and optionally copies a given string to it...
Definition: rapidxml.hpp:476
std::size_t value_size() const
Gets size of node value, not including terminator character.
Definition: rapidxml.hpp:700
void set_allocator(alloc_func *af, free_func *ff)
Sets or resets the user-defined memory allocation functions for the pool.
Definition: rapidxml.hpp:552
xml_document()
Constructs empty XML document.
Definition: rapidxml.hpp:1364
This class is used by the parser to create new nodes and attributes, without overheads of dynamic mem...
Definition: rapidxml.hpp:379
void append_attribute(xml_attribute< Ch > *attribute)
Appends a new attribute to the node.
Definition: rapidxml.hpp:1217
void parse(Ch *text)
Parses zero-terminated XML string according to given flags.
Definition: rapidxml.hpp:1381
memory_pool()
Constructs empty pool with default allocator functions.
Definition: rapidxml.hpp:390
Ch * name() const
Gets name of the node.
Definition: rapidxml.hpp:673
void remove_all_nodes()
Removes all child nodes (but not attributes).
Definition: rapidxml.hpp:1188
void remove_last_attribute()
Removes last attribute of the node.
Definition: rapidxml.hpp:1277
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets first child node, optionally matching node name.
Definition: rapidxml.hpp:936
void remove_first_attribute()
Removes first attribute of the node.
Definition: rapidxml.hpp:1260
void insert_node(xml_node< Ch > *where, xml_node< Ch > *child)
Inserts a new child node at specified place inside the node.
Definition: rapidxml.hpp:1119
void remove_attribute(xml_attribute< Ch > *where)
Removes specified attribute from node.
Definition: rapidxml.hpp:1293
Parse error exception.
Definition: rapidxml.hpp:71
xml_node< Ch > * last_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets last child node, optionally matching node name.
Definition: rapidxml.hpp:958
void name(const Ch *name)
Sets name of node to a zero-terminated string.
Definition: rapidxml.hpp:730
xml_node< Ch > * previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets previous sibling node, optionally matching node name.
Definition: rapidxml.hpp:981
void remove_last_node()
Removes last child of the node.
Definition: rapidxml.hpp:1155
void remove_node(xml_node< Ch > *where)
Removes specified child from the node.
Definition: rapidxml.hpp:1171
virtual const char * what() const override
Gets human readable description of error.
Definition: rapidxml.hpp:85
Class representing attribute node of XML document.
Definition: rapidxml.hpp:138
xml_attribute< Ch > * previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets previous attribute, optionally matching attribute name.
Definition: rapidxml.hpp:836
void remove_first_node()
Removes first child node.
Definition: rapidxml.hpp:1140
Ch * value() const
Gets value of node.
Definition: rapidxml.hpp:692
Definition: allocators.h:422
void append_node(xml_node< Ch > *child)
Appends a new child node.
Definition: rapidxml.hpp:1097
~memory_pool()
Destroys pool and frees all the memory.
Definition: rapidxml.hpp:400
xml_attribute()
Constructs an empty attribute with the specified type.
Definition: rapidxml.hpp:810
node_type type() const
Gets type of node.
Definition: rapidxml.hpp:913
xml_node< Ch > * allocate_node(node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)
Allocates a new node from the pool, and optionally assigns name and value to it.
Definition: rapidxml.hpp:415
Ch * where() const
Gets pointer to character data where error happened.
Definition: rapidxml.hpp:94
void type(node_type type)
Sets type of node.
Definition: rapidxml.hpp:1065
This class represents root of the DOM hierarchy.
Definition: rapidxml.hpp:139
Class representing a node of XML document.
Definition: rapidxml.hpp:137
xml_node< Ch > * next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets next sibling node, optionally matching node name.
Definition: rapidxml.hpp:1004
xml_attribute< Ch > * last_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets last attribute of node, optionally matching attribute name.
Definition: rapidxml.hpp:1045
Definition: rapidxml.hpp:57
void prepend_node(xml_node< Ch > *child)
Prepends a new child node.
Definition: rapidxml.hpp:1076
void insert_attribute(xml_attribute< Ch > *where, xml_attribute< Ch > *attribute)
Inserts a new attribute at specified place inside the node.
Definition: rapidxml.hpp:1239
parse_error(const char *what, void *where)
Constructs parse error.
Definition: rapidxml.hpp:77
void remove_all_attributes()
Removes all attributes of node.
Definition: rapidxml.hpp:1309
xml_attribute< Ch > * allocate_attribute(const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)
Allocates a new attribute from the pool, and optionally assigns name and value to it...
Definition: rapidxml.hpp:447
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets first attribute of node, optionally matching attribute name.
Definition: rapidxml.hpp:1025
void value(const Ch *value)
Sets value of node to a zero-terminated string.
Definition: rapidxml.hpp:760
xml_attribute< Ch > * next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets next attribute, optionally matching attribute name.
Definition: rapidxml.hpp:856
xml_document< Ch > * document() const
Gets document of which attribute is a child.
Definition: rapidxml.hpp:819