| pugixml.hpp | | pugixml.hpp | |
| /** | | /** | |
|
| * pugixml parser - version 1.2 | | * pugixml parser - version 1.4 | |
| * -------------------------------------------------------- | | * -------------------------------------------------------- | |
|
| * Copyright (C) 2006-2012, by Arseny Kapoulkine (arseny.kapoulkine@gmail.c
om) | | * Copyright (C) 2006-2014, by Arseny Kapoulkine (arseny.kapoulkine@gmail.c
om) | |
| * Report bugs and download new versions at http://pugixml.org/ | | * Report bugs and download new versions at http://pugixml.org/ | |
| * | | * | |
| * This library is distributed under the MIT License. See notice at the end | | * This library is distributed under the MIT License. See notice at the end | |
| * of this file. | | * of this file. | |
| * | | * | |
| * This work is based on the pugxml parser, which is: | | * This work is based on the pugxml parser, which is: | |
| * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) | | * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) | |
| */ | | */ | |
| | | | |
| #ifndef PUGIXML_VERSION | | #ifndef PUGIXML_VERSION | |
| // Define version macro; evaluates to major * 100 + minor so that it's safe
to use in less-than comparisons | | // Define version macro; evaluates to major * 100 + minor so that it's safe
to use in less-than comparisons | |
|
| # define PUGIXML_VERSION 120 | | # define PUGIXML_VERSION 140 | |
| #endif | | #endif | |
| | | | |
| // Include user configuration file (this can define various configuration m
acros) | | // Include user configuration file (this can define various configuration m
acros) | |
| #include "pugiconfig.hpp" | | #include "pugiconfig.hpp" | |
| | | | |
| #ifndef HEADER_PUGIXML_HPP | | #ifndef HEADER_PUGIXML_HPP | |
| #define HEADER_PUGIXML_HPP | | #define HEADER_PUGIXML_HPP | |
| | | | |
| // Include stddef.h for size_t and ptrdiff_t | | // Include stddef.h for size_t and ptrdiff_t | |
| #include <stddef.h> | | #include <stddef.h> | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 66 | |
| // If no API for classes is defined, assume default | | // If no API for classes is defined, assume default | |
| #ifndef PUGIXML_CLASS | | #ifndef PUGIXML_CLASS | |
| # define PUGIXML_CLASS PUGIXML_API | | # define PUGIXML_CLASS PUGIXML_API | |
| #endif | | #endif | |
| | | | |
| // If no API for functions is defined, assume default | | // If no API for functions is defined, assume default | |
| #ifndef PUGIXML_FUNCTION | | #ifndef PUGIXML_FUNCTION | |
| # define PUGIXML_FUNCTION PUGIXML_API | | # define PUGIXML_FUNCTION PUGIXML_API | |
| #endif | | #endif | |
| | | | |
|
| | | // If the platform is known to have long long support, enable long long fun | |
| | | ctions | |
| | | #ifndef PUGIXML_HAS_LONG_LONG | |
| | | # if defined(__cplusplus) && __cplusplus >= 201103 | |
| | | # define PUGIXML_HAS_LONG_LONG | |
| | | # elif defined(_MSC_VER) && _MSC_VER >= 1400 | |
| | | # define PUGIXML_HAS_LONG_LONG | |
| | | # endif | |
| | | #endif | |
| | | | |
| // Character interface macros | | // Character interface macros | |
| #ifdef PUGIXML_WCHAR_MODE | | #ifdef PUGIXML_WCHAR_MODE | |
| # define PUGIXML_TEXT(t) L ## t | | # define PUGIXML_TEXT(t) L ## t | |
| # define PUGIXML_CHAR wchar_t | | # define PUGIXML_CHAR wchar_t | |
| #else | | #else | |
| # define PUGIXML_TEXT(t) t | | # define PUGIXML_TEXT(t) t | |
| # define PUGIXML_CHAR char | | # define PUGIXML_CHAR char | |
| #endif | | #endif | |
| | | | |
| namespace pugi | | namespace pugi | |
| | | | |
| skipping to change at line 145 | | skipping to change at line 154 | |
| const unsigned int parse_declaration = 0x0100; | | const unsigned int parse_declaration = 0x0100; | |
| | | | |
| // This flag determines if document type declaration (node_doctype)
is added to the DOM tree. This flag is off by default. | | // This flag determines if document type declaration (node_doctype)
is added to the DOM tree. This flag is off by default. | |
| const unsigned int parse_doctype = 0x0200; | | const unsigned int parse_doctype = 0x0200; | |
| | | | |
| // This flag determines if plain character data (node_pcdata) that i
s the only child of the parent node and that consists only | | // This flag determines if plain character data (node_pcdata) that i
s the only child of the parent node and that consists only | |
| // of whitespace is added to the DOM tree. | | // of whitespace is added to the DOM tree. | |
| // This flag is off by default; turning it on may result in slower p
arsing and more memory consumption. | | // This flag is off by default; turning it on may result in slower p
arsing and more memory consumption. | |
| const unsigned int parse_ws_pcdata_single = 0x0400; | | const unsigned int parse_ws_pcdata_single = 0x0400; | |
| | | | |
|
| | | // This flag determines if leading and trailing whitespace is to be | |
| | | removed from plain character data. This flag is off by default. | |
| | | const unsigned int parse_trim_pcdata = 0x0800; | |
| | | | |
| | | // This flag determines if plain character data that does not have a | |
| | | parent node is added to the DOM tree, and if an empty document | |
| | | // is a valid document. This flag is off by default. | |
| | | const unsigned int parse_fragment = 0x1000; | |
| | | | |
| // The default parsing mode. | | // The default parsing mode. | |
| // Elements, PCDATA and CDATA sections are added to the DOM tree, ch
aracter/reference entities are expanded, | | // Elements, PCDATA and CDATA sections are added to the DOM tree, ch
aracter/reference entities are expanded, | |
| // End-of-Line characters are normalized, attribute values are norma
lized using CDATA normalization rules. | | // End-of-Line characters are normalized, attribute values are norma
lized using CDATA normalization rules. | |
| const unsigned int parse_default = parse_cdata | parse_escapes | par
se_wconv_attribute | parse_eol; | | const unsigned int parse_default = parse_cdata | parse_escapes | par
se_wconv_attribute | parse_eol; | |
| | | | |
| // The full parsing mode. | | // The full parsing mode. | |
| // Nodes of all types are added to the DOM tree, character/reference
entities are expanded, | | // Nodes of all types are added to the DOM tree, character/reference
entities are expanded, | |
| // End-of-Line characters are normalized, attribute values are norma
lized using CDATA normalization rules. | | // End-of-Line characters are normalized, attribute values are norma
lized using CDATA normalization rules. | |
| const unsigned int parse_full = parse_default | parse_pi | parse_com
ments | parse_declaration | parse_doctype; | | const unsigned int parse_full = parse_default | parse_pi | parse_com
ments | parse_declaration | parse_doctype; | |
| | | | |
| | | | |
| skipping to change at line 204 | | skipping to change at line 220 | |
| // Forward declarations | | // Forward declarations | |
| struct xml_attribute_struct; | | struct xml_attribute_struct; | |
| struct xml_node_struct; | | struct xml_node_struct; | |
| | | | |
| class xml_node_iterator; | | class xml_node_iterator; | |
| class xml_attribute_iterator; | | class xml_attribute_iterator; | |
| class xml_named_node_iterator; | | class xml_named_node_iterator; | |
| | | | |
| class xml_tree_walker; | | class xml_tree_walker; | |
| | | | |
|
| | | struct xml_parse_result; | |
| | | | |
| class xml_node; | | class xml_node; | |
| | | | |
| class xml_text; | | class xml_text; | |
| | | | |
| #ifndef PUGIXML_NO_XPATH | | #ifndef PUGIXML_NO_XPATH | |
| class xpath_node; | | class xpath_node; | |
| class xpath_node_set; | | class xpath_node_set; | |
| class xpath_query; | | class xpath_query; | |
| class xpath_variable_set; | | class xpath_variable_set; | |
| #endif | | #endif | |
| | | | |
| // Range-based for loop support | | // Range-based for loop support | |
| template <typename It> class xml_object_range | | template <typename It> class xml_object_range | |
| { | | { | |
| public: | | public: | |
| typedef It const_iterator; | | typedef It const_iterator; | |
|
| | | typedef It iterator; | |
| | | | |
| xml_object_range(It b, It e): _begin(b), _end(e) | | xml_object_range(It b, It e): _begin(b), _end(e) | |
| { | | { | |
| } | | } | |
| | | | |
| It begin() const { return _begin; } | | It begin() const { return _begin; } | |
| It end() const { return _end; } | | It end() const { return _end; } | |
| | | | |
| private: | | private: | |
| It _begin, _end; | | It _begin, _end; | |
| | | | |
| skipping to change at line 320 | | skipping to change at line 339 | |
| | | | |
| // Get attribute value, or the default value if attribute is
empty | | // Get attribute value, or the default value if attribute is
empty | |
| const char_t* as_string(const char_t* def = PUGIXML_TEXT("")
) const; | | const char_t* as_string(const char_t* def = PUGIXML_TEXT("")
) const; | |
| | | | |
| // Get attribute value as a number, or the default value if
conversion did not succeed or attribute is empty | | // Get attribute value as a number, or the default value if
conversion did not succeed or attribute is empty | |
| int as_int(int def = 0) const; | | int as_int(int def = 0) const; | |
| unsigned int as_uint(unsigned int def = 0) const; | | unsigned int as_uint(unsigned int def = 0) const; | |
| double as_double(double def = 0) const; | | double as_double(double def = 0) const; | |
| float as_float(float def = 0) const; | | float as_float(float def = 0) const; | |
| | | | |
|
| | | #ifdef PUGIXML_HAS_LONG_LONG | |
| | | long long as_llong(long long def = 0) const; | |
| | | unsigned long long as_ullong(unsigned long long def = 0) con | |
| | | st; | |
| | | #endif | |
| | | | |
| // Get attribute value as bool (returns true if first charac
ter is in '1tTyY' set), or the default value if attribute is empty | | // Get attribute value as bool (returns true if first charac
ter is in '1tTyY' set), or the default value if attribute is empty | |
| bool as_bool(bool def = false) const; | | bool as_bool(bool def = false) const; | |
| | | | |
| // Set attribute name/value (returns false if attribute is e
mpty or there is not enough memory) | | // Set attribute name/value (returns false if attribute is e
mpty or there is not enough memory) | |
| bool set_name(const char_t* rhs); | | bool set_name(const char_t* rhs); | |
| bool set_value(const char_t* rhs); | | bool set_value(const char_t* rhs); | |
| | | | |
| // Set attribute value with type conversion (numbers are con
verted to strings, boolean is converted to "true"/"false") | | // Set attribute value with type conversion (numbers are con
verted to strings, boolean is converted to "true"/"false") | |
| bool set_value(int rhs); | | bool set_value(int rhs); | |
| bool set_value(unsigned int rhs); | | bool set_value(unsigned int rhs); | |
| bool set_value(double rhs); | | bool set_value(double rhs); | |
| bool set_value(bool rhs); | | bool set_value(bool rhs); | |
| | | | |
|
| | | #ifdef PUGIXML_HAS_LONG_LONG | |
| | | bool set_value(long long rhs); | |
| | | bool set_value(unsigned long long rhs); | |
| | | #endif | |
| | | | |
| // Set attribute value (equivalent to set_value without erro
r checking) | | // Set attribute value (equivalent to set_value without erro
r checking) | |
| xml_attribute& operator=(const char_t* rhs); | | xml_attribute& operator=(const char_t* rhs); | |
| xml_attribute& operator=(int rhs); | | xml_attribute& operator=(int rhs); | |
| xml_attribute& operator=(unsigned int rhs); | | xml_attribute& operator=(unsigned int rhs); | |
| xml_attribute& operator=(double rhs); | | xml_attribute& operator=(double rhs); | |
| xml_attribute& operator=(bool rhs); | | xml_attribute& operator=(bool rhs); | |
| | | | |
|
| | | #ifdef PUGIXML_HAS_LONG_LONG | |
| | | xml_attribute& operator=(long long rhs); | |
| | | xml_attribute& operator=(unsigned long long rhs); | |
| | | #endif | |
| | | | |
| // Get next/previous attribute in the attribute list of the
parent node | | // Get next/previous attribute in the attribute list of the
parent node | |
| xml_attribute next_attribute() const; | | xml_attribute next_attribute() const; | |
| xml_attribute previous_attribute() const; | | xml_attribute previous_attribute() const; | |
| | | | |
| // Get hash value (unique for handles to the same object) | | // Get hash value (unique for handles to the same object) | |
| size_t hash_value() const; | | size_t hash_value() const; | |
| | | | |
| // Get internal pointer | | // Get internal pointer | |
| xml_attribute_struct* internal_object() const; | | xml_attribute_struct* internal_object() const; | |
| }; | | }; | |
| | | | |
| skipping to change at line 396 | | skipping to change at line 430 | |
| bool operator>(const xml_node& r) const; | | bool operator>(const xml_node& r) const; | |
| bool operator<=(const xml_node& r) const; | | bool operator<=(const xml_node& r) const; | |
| bool operator>=(const xml_node& r) const; | | bool operator>=(const xml_node& r) const; | |
| | | | |
| // Check if node is empty. | | // Check if node is empty. | |
| bool empty() const; | | bool empty() const; | |
| | | | |
| // Get node type | | // Get node type | |
| xml_node_type type() const; | | xml_node_type type() const; | |
| | | | |
|
| // Get node name/value, or "" if node is empty or it has no
name/value | | // Get node name, or "" if node is empty or it has no name | |
| const char_t* name() const; | | const char_t* name() const; | |
|
| | | | |
| | | // Get node value, or "" if node is empty or it has no value | |
| | | // Note: For <node>text</node> node.value() does not return "text"! | |
| | | Use child_value() or text() methods to access text inside nodes. | |
| const char_t* value() const; | | const char_t* value() const; | |
| | | | |
| // Get attribute list | | // Get attribute list | |
| xml_attribute first_attribute() const; | | xml_attribute first_attribute() const; | |
| xml_attribute last_attribute() const; | | xml_attribute last_attribute() const; | |
| | | | |
| // Get children list | | // Get children list | |
| xml_node first_child() const; | | xml_node first_child() const; | |
| xml_node last_child() const; | | xml_node last_child() const; | |
| | | | |
| | | | |
| skipping to change at line 475 | | skipping to change at line 512 | |
| xml_node insert_copy_before(const xml_node& proto, const xml
_node& node); | | xml_node insert_copy_before(const xml_node& proto, const xml
_node& node); | |
| | | | |
| // Remove specified attribute | | // Remove specified attribute | |
| bool remove_attribute(const xml_attribute& a); | | bool remove_attribute(const xml_attribute& a); | |
| bool remove_attribute(const char_t* name); | | bool remove_attribute(const char_t* name); | |
| | | | |
| // Remove specified child | | // Remove specified child | |
| bool remove_child(const xml_node& n); | | bool remove_child(const xml_node& n); | |
| bool remove_child(const char_t* name); | | bool remove_child(const char_t* name); | |
| | | | |
|
| | | // Parses buffer as an XML document fragment and appends all | |
| | | nodes as children of the current node. | |
| | | // Copies/converts the buffer, so it may be deleted or chang | |
| | | ed after the function returns. | |
| | | // Note: append_buffer allocates memory that has the lifetim | |
| | | e of the owning document; removing the appended nodes does not immediately | |
| | | reclaim that memory. | |
| | | xml_parse_result append_buffer(const void* contents, size_t | |
| | | size, unsigned int options = parse_default, xml_encoding encoding = encodin | |
| | | g_auto); | |
| | | | |
| // Find attribute using predicate. Returns first attribute f
or which predicate returned true. | | // Find attribute using predicate. Returns first attribute f
or which predicate returned true. | |
| template <typename Predicate> xml_attribute find_attribute(P
redicate pred) const | | template <typename Predicate> xml_attribute find_attribute(P
redicate pred) const | |
| { | | { | |
| if (!_root) return xml_attribute(); | | if (!_root) return xml_attribute(); | |
| | | | |
| for (xml_attribute attrib = first_attribute(); attri
b; attrib = attrib.next_attribute()) | | for (xml_attribute attrib = first_attribute(); attri
b; attrib = attrib.next_attribute()) | |
| if (pred(attrib)) | | if (pred(attrib)) | |
| return attrib; | | return attrib; | |
| | | | |
| return xml_attribute(); | | return xml_attribute(); | |
| | | | |
| skipping to change at line 629 | | skipping to change at line 671 | |
| | | | |
| // Get text, or the default value if object is empty | | // Get text, or the default value if object is empty | |
| const char_t* as_string(const char_t* def = PUGIXML_TEXT("")
) const; | | const char_t* as_string(const char_t* def = PUGIXML_TEXT("")
) const; | |
| | | | |
| // Get text as a number, or the default value if conversion
did not succeed or object is empty | | // Get text as a number, or the default value if conversion
did not succeed or object is empty | |
| int as_int(int def = 0) const; | | int as_int(int def = 0) const; | |
| unsigned int as_uint(unsigned int def = 0) const; | | unsigned int as_uint(unsigned int def = 0) const; | |
| double as_double(double def = 0) const; | | double as_double(double def = 0) const; | |
| float as_float(float def = 0) const; | | float as_float(float def = 0) const; | |
| | | | |
|
| | | #ifdef PUGIXML_HAS_LONG_LONG | |
| | | long long as_llong(long long def = 0) const; | |
| | | unsigned long long as_ullong(unsigned long long def = 0) con | |
| | | st; | |
| | | #endif | |
| | | | |
| // Get text as bool (returns true if first character is in '
1tTyY' set), or the default value if object is empty | | // Get text as bool (returns true if first character is in '
1tTyY' set), or the default value if object is empty | |
| bool as_bool(bool def = false) const; | | bool as_bool(bool def = false) const; | |
| | | | |
| // Set text (returns false if object is empty or there is no
t enough memory) | | // Set text (returns false if object is empty or there is no
t enough memory) | |
| bool set(const char_t* rhs); | | bool set(const char_t* rhs); | |
| | | | |
| // Set text with type conversion (numbers are converted to s
trings, boolean is converted to "true"/"false") | | // Set text with type conversion (numbers are converted to s
trings, boolean is converted to "true"/"false") | |
| bool set(int rhs); | | bool set(int rhs); | |
| bool set(unsigned int rhs); | | bool set(unsigned int rhs); | |
| bool set(double rhs); | | bool set(double rhs); | |
| bool set(bool rhs); | | bool set(bool rhs); | |
| | | | |
|
| | | #ifdef PUGIXML_HAS_LONG_LONG | |
| | | bool set(long long rhs); | |
| | | bool set(unsigned long long rhs); | |
| | | #endif | |
| | | | |
| // Set text (equivalent to set without error checking) | | // Set text (equivalent to set without error checking) | |
| xml_text& operator=(const char_t* rhs); | | xml_text& operator=(const char_t* rhs); | |
| xml_text& operator=(int rhs); | | xml_text& operator=(int rhs); | |
| xml_text& operator=(unsigned int rhs); | | xml_text& operator=(unsigned int rhs); | |
| xml_text& operator=(double rhs); | | xml_text& operator=(double rhs); | |
| xml_text& operator=(bool rhs); | | xml_text& operator=(bool rhs); | |
| | | | |
|
| | | #ifdef PUGIXML_HAS_LONG_LONG | |
| | | xml_text& operator=(long long rhs); | |
| | | xml_text& operator=(unsigned long long rhs); | |
| | | #endif | |
| | | | |
| // Get the data node (node_pcdata or node_cdata) for this ob
ject | | // Get the data node (node_pcdata or node_cdata) for this ob
ject | |
| xml_node data() const; | | xml_node data() const; | |
| }; | | }; | |
| | | | |
| #ifdef __BORLANDC__ | | #ifdef __BORLANDC__ | |
| // Borland C++ workaround | | // Borland C++ workaround | |
| bool PUGIXML_FUNCTION operator&&(const xml_text& lhs, bool rhs); | | bool PUGIXML_FUNCTION operator&&(const xml_text& lhs, bool rhs); | |
| bool PUGIXML_FUNCTION operator||(const xml_text& lhs, bool rhs); | | bool PUGIXML_FUNCTION operator||(const xml_text& lhs, bool rhs); | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 743 | | skipping to change at line 800 | |
| xml_attribute* operator->() const; | | xml_attribute* operator->() const; | |
| | | | |
| const xml_attribute_iterator& operator++(); | | const xml_attribute_iterator& operator++(); | |
| xml_attribute_iterator operator++(int); | | xml_attribute_iterator operator++(int); | |
| | | | |
| const xml_attribute_iterator& operator--(); | | const xml_attribute_iterator& operator--(); | |
| xml_attribute_iterator operator--(int); | | xml_attribute_iterator operator--(int); | |
| }; | | }; | |
| | | | |
| // Named node range helper | | // Named node range helper | |
|
| class xml_named_node_iterator | | class PUGIXML_CLASS xml_named_node_iterator | |
| { | | { | |
|
| | | friend class xml_node; | |
| | | | |
| public: | | public: | |
| // Iterator traits | | // Iterator traits | |
| typedef ptrdiff_t difference_type; | | typedef ptrdiff_t difference_type; | |
| typedef xml_node value_type; | | typedef xml_node value_type; | |
| typedef xml_node* pointer; | | typedef xml_node* pointer; | |
| typedef xml_node& reference; | | typedef xml_node& reference; | |
| | | | |
| #ifndef PUGIXML_NO_STL | | #ifndef PUGIXML_NO_STL | |
|
| typedef std::forward_iterator_tag iterator_category; | | typedef std::bidirectional_iterator_tag iterator_category; | |
| #endif | | #endif | |
| | | | |
| // Default constructor | | // Default constructor | |
| xml_named_node_iterator(); | | xml_named_node_iterator(); | |
| | | | |
| // Construct an iterator which points to the specified node | | // Construct an iterator which points to the specified node | |
| xml_named_node_iterator(const xml_node& node, const char_t*
name); | | xml_named_node_iterator(const xml_node& node, const char_t*
name); | |
| | | | |
| // Iterator operators | | // Iterator operators | |
| bool operator==(const xml_named_node_iterator& rhs) const; | | bool operator==(const xml_named_node_iterator& rhs) const; | |
| bool operator!=(const xml_named_node_iterator& rhs) const; | | bool operator!=(const xml_named_node_iterator& rhs) const; | |
| | | | |
| xml_node& operator*() const; | | xml_node& operator*() const; | |
| xml_node* operator->() const; | | xml_node* operator->() const; | |
| | | | |
| const xml_named_node_iterator& operator++(); | | const xml_named_node_iterator& operator++(); | |
| xml_named_node_iterator operator++(int); | | xml_named_node_iterator operator++(int); | |
| | | | |
|
| | | const xml_named_node_iterator& operator--(); | |
| | | xml_named_node_iterator operator--(int); | |
| | | | |
| private: | | private: | |
|
| mutable xml_node _node; | | mutable xml_node _wrap; | |
| | | xml_node _parent; | |
| const char_t* _name; | | const char_t* _name; | |
|
| | | | |
| | | xml_named_node_iterator(xml_node_struct* ref, xml_node_struc | |
| | | t* parent, const char_t* name); | |
| }; | | }; | |
| | | | |
| // Abstract tree walker class (see xml_node::traverse) | | // Abstract tree walker class (see xml_node::traverse) | |
| class PUGIXML_CLASS xml_tree_walker | | class PUGIXML_CLASS xml_tree_walker | |
| { | | { | |
| friend class xml_node; | | friend class xml_node; | |
| | | | |
| private: | | private: | |
| int _depth; | | int _depth; | |
| | | | |
| | | | |
| skipping to change at line 823 | | skipping to change at line 888 | |
| status_unrecognized_tag, // Parser could not determin
e tag type | | status_unrecognized_tag, // Parser could not determin
e tag type | |
| | | | |
| status_bad_pi, // Parsing error occ
urred while parsing document declaration/processing instruction | | status_bad_pi, // Parsing error occ
urred while parsing document declaration/processing instruction | |
| status_bad_comment, // Parsing error occ
urred while parsing comment | | status_bad_comment, // Parsing error occ
urred while parsing comment | |
| status_bad_cdata, // Parsing error occ
urred while parsing CDATA section | | status_bad_cdata, // Parsing error occ
urred while parsing CDATA section | |
| status_bad_doctype, // Parsing error occ
urred while parsing document type declaration | | status_bad_doctype, // Parsing error occ
urred while parsing document type declaration | |
| status_bad_pcdata, // Parsing error occ
urred while parsing PCDATA section | | status_bad_pcdata, // Parsing error occ
urred while parsing PCDATA section | |
| status_bad_start_element, // Parsing error occurred wh
ile parsing start element tag | | status_bad_start_element, // Parsing error occurred wh
ile parsing start element tag | |
| status_bad_attribute, // Parsing error occurred wh
ile parsing element attribute | | status_bad_attribute, // Parsing error occurred wh
ile parsing element attribute | |
| status_bad_end_element, // Parsing error occurred wh
ile parsing end element tag | | status_bad_end_element, // Parsing error occurred wh
ile parsing end element tag | |
|
| status_end_element_mismatch // There was a mismatch of start | | status_end_element_mismatch,// There was a mismatch of start | |
| -end tags (closing tag had incorrect name, some tag was not closed or there | | -end tags (closing tag had incorrect name, some tag was not closed or there | |
| was an excessive closing tag) | | was an excessive closing tag) | |
| | | | |
| | | status_append_invalid_root, // Unable to append nodes si | |
| | | nce root type is not node_element or node_document (exclusive to xml_node:: | |
| | | append_buffer) | |
| | | | |
| | | status_no_document_element // Parsing resulted in a doc | |
| | | ument without element nodes | |
| }; | | }; | |
| | | | |
| // Parsing result | | // Parsing result | |
| struct PUGIXML_CLASS xml_parse_result | | struct PUGIXML_CLASS xml_parse_result | |
| { | | { | |
| // Parsing status (see xml_parse_status) | | // Parsing status (see xml_parse_status) | |
| xml_parse_status status; | | xml_parse_status status; | |
| | | | |
| // Last parsed offset (in char_t units from start of input d
ata) | | // Last parsed offset (in char_t units from start of input d
ata) | |
| ptrdiff_t offset; | | ptrdiff_t offset; | |
| | | | |
| skipping to change at line 863 | | skipping to change at line 932 | |
| | | | |
| char _memory[192]; | | char _memory[192]; | |
| | | | |
| // Non-copyable semantics | | // Non-copyable semantics | |
| xml_document(const xml_document&); | | xml_document(const xml_document&); | |
| const xml_document& operator=(const xml_document&); | | const xml_document& operator=(const xml_document&); | |
| | | | |
| void create(); | | void create(); | |
| void destroy(); | | void destroy(); | |
| | | | |
|
| xml_parse_result load_buffer_impl(void* contents, size_t siz | | | |
| e, unsigned int options, xml_encoding encoding, bool is_mutable, bool own); | | | |
| | | | |
| public: | | public: | |
| // Default constructor, makes empty document | | // Default constructor, makes empty document | |
| xml_document(); | | xml_document(); | |
| | | | |
| // Destructor, invalidates all node/attribute handles to thi
s document | | // Destructor, invalidates all node/attribute handles to thi
s document | |
| ~xml_document(); | | ~xml_document(); | |
| | | | |
| // Removes all nodes, leaving the empty document | | // Removes all nodes, leaving the empty document | |
| void reset(); | | void reset(); | |
| | | | |
| | | | |
| skipping to change at line 1226 | | skipping to change at line 1293 | |
| allocation_function PUGIXML_FUNCTION get_memory_allocation_function(
); | | allocation_function PUGIXML_FUNCTION get_memory_allocation_function(
); | |
| deallocation_function PUGIXML_FUNCTION get_memory_deallocation_funct
ion(); | | deallocation_function PUGIXML_FUNCTION get_memory_deallocation_funct
ion(); | |
| } | | } | |
| | | | |
| #if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC)) | | #if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC)) | |
| namespace std | | namespace std | |
| { | | { | |
| // Workarounds for (non-standard) iterator category detection for ol
der versions (MSVC7/IC8 and earlier) | | // Workarounds for (non-standard) iterator category detection for ol
der versions (MSVC7/IC8 and earlier) | |
| std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pug
i::xml_node_iterator&); | | std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pug
i::xml_node_iterator&); | |
| std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pug
i::xml_attribute_iterator&); | | std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pug
i::xml_attribute_iterator&); | |
|
| std::forward_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml
_named_node_iterator&); | | std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pug
i::xml_named_node_iterator&); | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC) | | #if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC) | |
| namespace std | | namespace std | |
| { | | { | |
| // Workarounds for (non-standard) iterator category detection | | // Workarounds for (non-standard) iterator category detection | |
| std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category
(const pugi::xml_node_iterator&); | | std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category
(const pugi::xml_node_iterator&); | |
| std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category
(const pugi::xml_attribute_iterator&); | | std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category
(const pugi::xml_attribute_iterator&); | |
|
| std::forward_iterator_tag PUGIXML_FUNCTION __iterator_category(const
pugi::xml_named_node_iterator&); | | std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category
(const pugi::xml_named_node_iterator&); | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
|
| * Copyright (c) 2006-2012 Arseny Kapoulkine | | * Copyright (c) 2006-2014 Arseny Kapoulkine | |
| * | | * | |
| * Permission is hereby granted, free of charge, to any person | | * Permission is hereby granted, free of charge, to any person | |
| * obtaining a copy of this software and associated documentation | | * obtaining a copy of this software and associated documentation | |
| * files (the "Software"), to deal in the Software without | | * files (the "Software"), to deal in the Software without | |
| * restriction, including without limitation the rights to use, | | * restriction, including without limitation the rights to use, | |
| * copy, modify, merge, publish, distribute, sublicense, and/or sell | | * copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the | | * copies of the Software, and to permit persons to whom the | |
| * Software is furnished to do so, subject to the following | | * Software is furnished to do so, subject to the following | |
| * conditions: | | * conditions: | |
| * | | * | |
| | | | |
End of changes. 27 change blocks. |
| 16 lines changed or deleted | | 98 lines changed or added | |
|