diff --git a/Makefile b/Makefile index 0fb127c..1c5e023 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ BUILD=build/make-$(firstword $(CXX))-$(config)-$(defines)-$(cxxstd) SOURCES=src/pugixml.cpp $(filter-out tests/fuzz_%,$(wildcard tests/*.cpp)) EXECUTABLE=$(BUILD)/test -VERSION=$(shell sed -n 's/.*version \(.*\).*/\1/p' src/pugiconfig.hpp) +VERSION=$(shell sed -n 's/.*version \(.*\).*/\1/p; /version/q' src/pugiconfig.hpp) RELEASE=$(filter-out scripts/archive.py docs/%.adoc,$(shell git ls-files docs scripts src CMakeLists.txt LICENSE.md readme.txt)) CXXFLAGS=-g -Wall -Wextra -Werror -pedantic -Wundef -Wshadow -Wcast-align -Wcast-qual -Wold-style-cast -Wdouble-promotion diff --git a/docs/manual.adoc b/docs/manual.adoc index 16bb46c..79d6106 100644 --- a/docs/manual.adoc +++ b/docs/manual.adoc @@ -244,6 +244,8 @@ NOTE: In that example `PUGIXML_API` is inconsistent between several source files [[PUGIXML_HAS_LONG_LONG]]`PUGIXML_HAS_LONG_LONG` define enables support for `long long` type in pugixml. This define is automatically enabled if your platform is known to have `long long` support (i.e. has C{plus}{plus}11 support or uses a reasonably modern version of a known compiler); if pugixml does not recognize that your platform supports `long long` but in fact it does, you can enable the define manually. +[[PUGIXML_HAS_STRING_VIEW]]`PUGIXML_HAS_STRING_VIEW` define enables function overloads that accept `std::basic_string_view` arguments. This define is automatically enabled if built targeting C++17 or later AND if `PUGIXML_STRING_VIEW` is also defined. The requirement to additionally define `PUGIXML_STRING_VIEW` will be retired in a future version. + [[install.portability]] === Portability @@ -419,8 +421,8 @@ const wchar_t* xml_node::name() const; bool xml_node::set_name(const wchar_t* value); ---- -[[char_t]][[string_t]] -There is a special type, `pugi::char_t`, that is defined as the character type and depends on the library configuration; it will be also used in the documentation hereafter. There is also a type `pugi::string_t`, which is defined as the STL string of the character type; it corresponds to `std::string` in char mode and to `std::wstring` in wchar_t mode. +[[char_t]][[string_t]][[string_view_t]] +There is a special type, `pugi::char_t`, that is defined as the character type and depends on the library configuration; it will be also used in the documentation hereafter. There is also a type `pugi::string_t`, which is defined as the STL string of the character type; it corresponds to `std::string` in char mode and to `std::wstring` in wchar_t mode. Similarly, `string_view_t` is defined to be `std::basic_string_view`. Overloads for `string_view_t` are only available when building for C++17 or later (see `PUGIXML_HAS_STRING_VIEW`). In addition to the interface, the internal implementation changes to store XML data as `pugi::char_t`; this means that these two modes have different memory usage characteristics - generally UTF-8 mode is more memory and performance efficient, especially if `sizeof(wchar_t)` is 4. The conversion to `pugi::char_t` upon document loading and from `pugi::char_t` upon document saving happen automatically, which also carries minor performance penalty. The general advice however is to select the character mode based on usage scenario, i.e. if UTF-8 is inconvenient to process and most of your XML data is non-ASCII, wchar_t mode is probably a better choice. @@ -957,9 +959,13 @@ Since a lot of document traversal consists of finding the node/attribute with th [source] ---- xml_node xml_node::child(const char_t* name) const; +xml_node xml_node::child(string_view_t name) const; xml_attribute xml_node::attribute(const char_t* name) const; +xml_attribute xml_node::attribute(string_view_t name) const; xml_node xml_node::next_sibling(const char_t* name) const; +xml_node xml_node::next_sibling(string_view_t name) const; xml_node xml_node::previous_sibling(const char_t* name) const; +xml_node xml_node::previous_sibling(string_view_t name) const; ---- `child` and `attribute` return the first child/attribute with the specified name; `next_sibling` and `previous_sibling` return the first sibling in the corresponding direction with the specified name. All string comparisons are case-sensitive. In case the node handle is null or there is no node/attribute with the specified name, null handle is returned. @@ -977,6 +983,7 @@ for (pugi::xml_node tool = tools.child("Tool"); tool; tool = tool.next_sibling(" [source] ---- xml_attribute xml_node::attribute(const char_t* name, xml_attribute& hint) const; +xml_attribute xml_node::attribute(string_view_t name, xml_attribute& hint) const; ---- The extra `hint` argument is used to guess where the attribute might be, and is updated to the location of the next attribute so that if you search for multiple attributes in the right order, the performance is maximized. Note that `hint` has to be either null or has to belong to the node, otherwise the behavior is undefined. @@ -1289,9 +1296,11 @@ As discussed before, nodes can have name and value, both of which are strings. D [source] ---- bool xml_node::set_name(const char_t* rhs); -bool xml_node::set_name(const char_t* rhs, size_t sz) +bool xml_node::set_name(const char_t* rhs, size_t sz); +bool xml_node::set_name(string_view_t rhs); bool xml_node::set_value(const char_t* rhs); bool xml_node::set_value(const char_t* rhs, size_t size); +bool xml_node::set_value(string_view_t rhs); ---- Both functions try to set the name/value to the specified string, and return the operation result. The operation fails if the node can not have name or value (for instance, when trying to call `set_name` on a <> node), if the node handle is null, or if there is insufficient memory to handle the request. The provided string is copied into document managed memory and can be destroyed after the function returns (for example, you can safely pass stack-allocated buffers to these functions). The name/value content is not verified, so take care to use only valid XML names, or the document may become malformed. @@ -1312,9 +1321,11 @@ All attributes have name and value, both of which are strings (value may be empt [source] ---- bool xml_attribute::set_name(const char_t* rhs); -bool xml_attribute::set_name(const char_t* rhs, size_t sz) +bool xml_attribute::set_name(const char_t* rhs, size_t sz); +bool xml_attribute::set_name(string_view_t rhs); bool xml_attribute::set_value(const char_t* rhs); bool xml_attribute::set_value(const char_t* rhs, size_t size); +bool xml_attribute::set_value(string_view_t rhs); ---- Both functions try to set the name/value to the specified string, and return the operation result. The operation fails if the attribute handle is null, or if there is insufficient memory to handle the request. The provided string is copied into document managed memory and can be destroyed after the function returns (for example, you can safely pass stack-allocated buffers to these functions). The name/value content is not verified, so take care to use only valid XML names, or the document may become malformed. @@ -1349,6 +1360,7 @@ For convenience, all `set_value` functions have the corresponding assignment ope [source] ---- xml_attribute& xml_attribute::operator=(const char_t* rhs); +xml_attribute& xml_attribute::operator=(string_view_t rhs); xml_attribute& xml_attribute::operator=(int rhs); xml_attribute& xml_attribute::operator=(unsigned int rhs); xml_attribute& xml_attribute::operator=(long rhs); @@ -1378,9 +1390,13 @@ Nodes and attributes do not exist without a document tree, so you can't create t [source] ---- xml_attribute xml_node::append_attribute(const char_t* name); +xml_attribute xml_node::append_attribute(string_view_t name); xml_attribute xml_node::prepend_attribute(const char_t* name); +xml_attribute xml_node::prepend_attribute(string_view_t name); xml_attribute xml_node::insert_attribute_after(const char_t* name, const xml_attribute& attr); +xml_attribute xml_node::insert_attribute_after(string_view_t name, const xml_attribute& attr); xml_attribute xml_node::insert_attribute_before(const char_t* name, const xml_attribute& attr); +xml_attribute xml_node::insert_attribute_before(string_view_t name, const xml_attribute& attr); xml_node xml_node::append_child(xml_node_type type = node_element); xml_node xml_node::prepend_child(xml_node_type type = node_element); @@ -1388,9 +1404,13 @@ xml_node xml_node::insert_child_after(xml_node_type type, const xml_node& node); xml_node xml_node::insert_child_before(xml_node_type type, const xml_node& node); xml_node xml_node::append_child(const char_t* name); +xml_node xml_node::append_child(string_view_t name); xml_node xml_node::prepend_child(const char_t* name); +xml_node xml_node::prepend_child(string_view_t name); xml_node xml_node::insert_child_after(const char_t* name, const xml_node& node); +xml_node xml_node::insert_child_after(string_view_t name, const xml_node& node); xml_node xml_node::insert_child_before(const char_t* name, const xml_node& node); +xml_node xml_node::insert_child_before(string_view_t name, const xml_node& node); ---- `append_attribute` and `append_child` create a new node/attribute at the end of the corresponding list of the node the method is called on; `prepend_attribute` and `prepend_child` create a new node/attribute at the beginning of the list; `insert_attribute_after`, `insert_attribute_before`, `insert_child_after` and `insert_attribute_before` add the node/attribute before or after the specified node/attribute. @@ -1445,7 +1465,9 @@ If you want to remove the attribute or child node by its name, two additional he [source] ---- bool xml_node::remove_attribute(const char_t* name); +bool xml_node::remove_attribute(string_view_t name); bool xml_node::remove_child(const char_t* name); +bool xml_node::remove_child(string_view_t name); ---- These functions look for the first attribute or child with the specified name, and then remove it, returning the result. If there is no attribute or child with such name, the function returns `false`; if there are two nodes with the given name, only the first node is deleted. If you want to delete all nodes with the specified name, you can use code like this: `while (node.remove_child("tool")) ;`. @@ -1469,6 +1491,7 @@ Once you have an `xml_text` object, you can set the text contents using the foll ---- bool xml_text::set(const char_t* rhs); bool xml_text::set(const char_t* rhs, size_t size); +bool xml_text::set(string_view_t rhs); ---- This function tries to set the contents to the specified string, and returns the operation result. The operation fails if the text object was retrieved from a node that can not have a value and is not an element node (i.e. it is a <> node), if the text object is empty, or if there is insufficient memory to handle the request. The provided string is copied into document managed memory and can be destroyed after the function returns (for example, you can safely pass stack-allocated buffers to this function). Note that if the text object was retrieved from an element node, this function creates the PCDATA child node if necessary (i.e. if the element node does not have a PCDATA/CDATA child already). @@ -1500,6 +1523,7 @@ For convenience, all `set` functions have the corresponding assignment operators [source] ---- xml_text& xml_text::operator=(const char_t* rhs); +xml_text& xml_text::operator=(string_view_t rhs); xml_text& xml_text::operator=(int rhs); xml_text& xml_text::operator=(unsigned int rhs); xml_text& xml_text::operator=(long rhs); @@ -2733,6 +2757,7 @@ This is the reference for all macros, types, enumerations, classes and functions #define +++PUGIXML_MEMORY_XPATH_PAGE_SIZE+++ #define +++PUGIXML_HEADER_ONLY+++ #define +++PUGIXML_HAS_LONG_LONG+++ +#define +++PUGIXML_HAS_STRING_VIEW+++ ---- [[apiref.types]] @@ -2742,6 +2767,7 @@ This is the reference for all macros, types, enumerations, classes and functions ---- typedef configuration-defined-type +++char_t+++; typedef configuration-defined-type +++string_t+++; +typedef configuration-defined-type +++string_view_t+++; typedef void* (*+++allocation_function+++)(size_t size); typedef void (*+++deallocation_function+++)(void* ptr); ---- @@ -2877,8 +2903,10 @@ const unsigned int +++parse_wnorm_attribute bool +++set_name+++(const char_t* rhs); bool +++set_name+++(const char_t* rhs, size_t size); + bool +++set_name+++(string_view_t rhs); bool +++set_value+++(const char_t* rhs); bool +++set_value+++(const char_t* rhs, size_t size); + bool +++set_value+++(string_view_t rhs); bool +++set_value+++(int rhs); bool +++set_value+++(unsigned int rhs); bool +++set_value+++(long rhs); @@ -2890,6 +2918,7 @@ const unsigned int +++parse_wnorm_attribute bool +++set_value+++(unsigned long long rhs); xml_attribute& +++operator=+++(const char_t* rhs); + xml_attribute& +++operator=+++(string_view_t rhs); xml_attribute& +++operator=+++(int rhs); xml_attribute& +++operator=+++(unsigned int rhs); xml_attribute& +++operator=+++(long rhs); @@ -2934,11 +2963,16 @@ const unsigned int +++parse_wnorm_attribute implementation-defined-type +++attributes+++() const; xml_node +++child+++(const char_t* name) const; + xml_node +++child+++(string_view_t name) const; xml_attribute +++attribute+++(const char_t* name) const; + xml_attribute +++attribute+++(string_view_t name) const; xml_node +++next_sibling+++(const char_t* name) const; + xml_node +++next_sibling+++(string_view_t name) const; xml_node +++previous_sibling+++(const char_t* name) const; + xml_node +++previous_sibling+++(string_view_t name) const; xml_attribute +++attribute+++(const char_t* name, xml_attribute& hint) const; + xml_attribute +++attribute+++(string_view_t name, xml_attribute& hint) const; xml_node +++find_child_by_attribute+++(const char_t* name, const char_t* attr_name, const char_t* attr_value) const; xml_node +++find_child_by_attribute+++(const char_t* attr_name, const char_t* attr_value) const; @@ -2968,13 +3002,19 @@ const unsigned int +++parse_wnorm_attribute bool +++set_name+++(const char_t* rhs); bool +++set_name+++(const char_t* rhs, size_t size); + bool +++set_name+++(string_view_t rhs); bool +++set_value+++(const char_t* rhs); bool +++set_value+++(const char_t* rhs, size_t size); + bool +++set_value+++(string_view_t rhs); xml_attribute +++append_attribute+++(const char_t* name); + xml_attribute +++append_attribute+++(string_view_t name); xml_attribute +++prepend_attribute+++(const char_t* name); + xml_attribute +++prepend_attribute+++(string_view_t name); xml_attribute +++insert_attribute_after+++(const char_t* name, const xml_attribute& attr); + xml_attribute +++insert_attribute_after+++(string_view_t name, const xml_attribute& attr); xml_attribute +++insert_attribute_before+++(const char_t* name, const xml_attribute& attr); + xml_attribute +++insert_attribute_before+++(string_view_t name, const xml_attribute& attr); xml_node +++append_child+++(xml_node_type type = node_element); xml_node +++prepend_child+++(xml_node_type type = node_element); @@ -2982,9 +3022,13 @@ const unsigned int +++parse_wnorm_attribute xml_node +++insert_child_before+++(xml_node_type type, const xml_node& node); xml_node +++append_child+++(const char_t* name); + xml_node +++append_child+++(string_view_t name); xml_node +++prepend_child+++(const char_t* name); + xml_node +++prepend_child+++(string_view_t name); xml_node +++insert_child_after+++(const char_t* name, const xml_node& node); + xml_node +++insert_child_after+++(string_view_t name, const xml_node& node); xml_node +++insert_child_before+++(const char_t* name, const xml_node& node); + xml_node +++insert_child_before+++(string_view_t name, const xml_node& node); xml_attribute +++append_copy+++(const xml_attribute& proto); xml_attribute +++prepend_copy+++(const xml_attribute& proto); @@ -3003,9 +3047,11 @@ const unsigned int +++parse_wnorm_attribute bool +++remove_attribute+++(const xml_attribute& a); bool +++remove_attribute+++(const char_t* name); + bool +++remove_attribute+++(string_view_t name); bool +++remove_attributes+++(); bool +++remove_child+++(const xml_node& n); bool +++remove_child+++(const char_t* name); + bool +++remove_child+++(string_view_t name); bool +++remove_children+++(); xml_parse_result +++append_buffer+++(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto); @@ -3083,6 +3129,7 @@ const unsigned int +++parse_wnorm_attribute bool +++set+++(const char_t* rhs); bool +++set+++(const char_t* rhs, size_t size); + bool +++set+++(string_view_t rhs); bool +++set+++(int rhs); bool +++set+++(unsigned int rhs); @@ -3095,6 +3142,7 @@ const unsigned int +++parse_wnorm_attribute bool +++set+++(unsigned long long rhs); xml_text& +++operator=+++(const char_t* rhs); + xml_text& +++operator=+++(string_view_t rhs); xml_text& +++operator=+++(int rhs); xml_text& +++operator=+++(unsigned int rhs); xml_text& +++operator=+++(long rhs); diff --git a/docs/manual.html b/docs/manual.html index 3f536ff..c460cf4 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -4,7 +4,7 @@ - + pugixml 1.14 manual @@ -141,7 +141,7 @@ p a>code:hover{color:rgba(0,0,0,.9)} #content::before{content:none} #header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0} #header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf} -#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px} +#header>h1:only-child{border-bottom:1px solid #dddddf;padding-bottom:8px} #header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:flex;flex-flow:row wrap} #header .details span:first-child{margin-left:-.125em} #header .details span.email a{color:rgba(0,0,0,.85)} @@ -163,6 +163,7 @@ p a>code:hover{color:rgba(0,0,0,.9)} #toctitle{color:#7a2518;font-size:1.2em} @media screen and (min-width:768px){#toctitle{font-size:1.375em} body.toc2{padding-left:15em;padding-right:0} +body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px} #toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto} #toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em} #toc.toc2>ul{font-size:.9em;margin-bottom:0} @@ -328,7 +329,7 @@ a.image{text-decoration:none;display:inline-block} a.image object{pointer-events:none} sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super} sup.footnote a,sup.footnoteref a{text-decoration:none} -sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline} +sup.footnote a:active,sup.footnoteref a:active,#footnotes .footnote a:first-of-type:active{text-decoration:underline} #footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em} #footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0} #footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em} @@ -1026,6 +1027,9 @@ In that example PUGIXML_API is inconsistent between several source

PUGIXML_HAS_LONG_LONG define enables support for long long type in pugixml. This define is automatically enabled if your platform is known to have long long support (i.e. has C++11 support or uses a reasonably modern version of a known compiler); if pugixml does not recognize that your platform supports long long but in fact it does, you can enable the define manually.

+
+

PUGIXML_HAS_STRING_VIEW define enables function overloads that accept std::basic_string_view arguments. This define is automatically enabled if built targeting c++17 or later AND if PUGIXML_STRING_VIEW is also defined. The requirement to additionally define PUGIXML_STRING_VIEW will be retired in a future version.

+
@@ -1290,8 +1294,8 @@ If the size of wchar_t is 2, pugixml assumes UTF-16 encoding instea
-

-There is a special type, pugi::char_t, that is defined as the character type and depends on the library configuration; it will be also used in the documentation hereafter. There is also a type pugi::string_t, which is defined as the STL string of the character type; it corresponds to std::string in char mode and to std::wstring in wchar_t mode.

+

+There is a special type, pugi::char_t, that is defined as the character type and depends on the library configuration; it will be also used in the documentation hereafter. There is also a type pugi::string_t, which is defined as the STL string of the character type; it corresponds to std::string in char mode and to std::wstring in wchar_t mode. Similarly, string_view_t is defined to be std::basic_string_view<char_t>. Overloads for string_view_t are only available when building for c++17 or later (see PUGIXML_HAS_STRING_VIEW).

In addition to the interface, the internal implementation changes to store XML data as pugi::char_t; this means that these two modes have different memory usage characteristics - generally UTF-8 mode is more memory and performance efficient, especially if sizeof(wchar_t) is 4. The conversion to pugi::char_t upon document loading and from pugi::char_t upon document saving happen automatically, which also carries minor performance penalty. The general advice however is to select the character mode based on usage scenario, i.e. if UTF-8 is inconvenient to process and most of your XML data is non-ASCII, wchar_t mode is probably a better choice.

@@ -2187,9 +2191,13 @@ Since a lot of document traversal consists of finding the node/attribute with th
xml_node xml_node::child(const char_t* name) const;
+xml_node xml_node::child(string_view_t name) const;
 xml_attribute xml_node::attribute(const char_t* name) const;
+xml_attribute xml_node::attribute(string_view_t name) const;
 xml_node xml_node::next_sibling(const char_t* name) const;
-xml_node xml_node::previous_sibling(const char_t* name) const;
+xml_node xml_node::next_sibling(string_view_t name) const; +xml_node xml_node::previous_sibling(const char_t* name) const; +xml_node xml_node::previous_sibling(string_view_t name) const;
@@ -2208,7 +2216,8 @@ Since a lot of document traversal consists of finding the node/attribute with th
-
xml_attribute xml_node::attribute(const char_t* name, xml_attribute& hint) const;
+
xml_attribute xml_node::attribute(const char_t* name, xml_attribute& hint) const;
+xml_attribute xml_node::attribute(string_view_t name, xml_attribute& hint) const;
@@ -2662,9 +2671,11 @@ As discussed before, nodes can have name and value, both of which are strings. D
bool xml_node::set_name(const char_t* rhs);
-bool xml_node::set_name(const char_t* rhs, size_t sz)
-bool xml_node::set_value(const char_t* rhs);
-bool xml_node::set_value(const char_t* rhs, size_t size);
+bool xml_node::set_name(const char_t* rhs, size_t sz); +bool xml_node::set_name(string_view_t rhs); +bool xml_node::set_value(const char_t* rhs); +bool xml_node::set_value(const char_t* rhs, size_t size); +bool xml_node::set_value(string_view_t rhs);
@@ -2699,9 +2710,11 @@ All attributes have name and value, both of which are strings (value may be empt
bool xml_attribute::set_name(const char_t* rhs);
-bool xml_attribute::set_name(const char_t* rhs, size_t sz)
-bool xml_attribute::set_value(const char_t* rhs);
-bool xml_attribute::set_value(const char_t* rhs, size_t size);
+bool xml_attribute::set_name(const char_t* rhs, size_t sz); +bool xml_attribute::set_name(string_view_t rhs); +bool xml_attribute::set_value(const char_t* rhs); +bool xml_attribute::set_value(const char_t* rhs, size_t size); +bool xml_attribute::set_value(string_view_t rhs);
@@ -2758,6 +2771,7 @@ Number conversion functions depend on current C locale as set with setloca
xml_attribute& xml_attribute::operator=(const char_t* rhs);
+xml_attribute& xml_attribute::operator=(string_view_t rhs);
 xml_attribute& xml_attribute::operator=(int rhs);
 xml_attribute& xml_attribute::operator=(unsigned int rhs);
 xml_attribute& xml_attribute::operator=(long rhs);
@@ -2802,9 +2816,13 @@ Nodes and attributes do not exist without a document tree, so you can’t cr
 
xml_attribute xml_node::append_attribute(const char_t* name);
+xml_attribute xml_node::append_attribute(string_view_t name);
 xml_attribute xml_node::prepend_attribute(const char_t* name);
+xml_attribute xml_node::prepend_attribute(string_view_t name);
 xml_attribute xml_node::insert_attribute_after(const char_t* name, const xml_attribute& attr);
+xml_attribute xml_node::insert_attribute_after(string_view_t name, const xml_attribute& attr);
 xml_attribute xml_node::insert_attribute_before(const char_t* name, const xml_attribute& attr);
+xml_attribute xml_node::insert_attribute_before(string_view_t name, const xml_attribute& attr);
 
 xml_node xml_node::append_child(xml_node_type type = node_element);
 xml_node xml_node::prepend_child(xml_node_type type = node_element);
@@ -2812,9 +2830,13 @@ Nodes and attributes do not exist without a document tree, so you can’t cr
 xml_node xml_node::insert_child_before(xml_node_type type, const xml_node& node);
 
 xml_node xml_node::append_child(const char_t* name);
+xml_node xml_node::append_child(string_view_t name);
 xml_node xml_node::prepend_child(const char_t* name);
+xml_node xml_node::prepend_child(string_view_t name);
 xml_node xml_node::insert_child_after(const char_t* name, const xml_node& node);
-xml_node xml_node::insert_child_before(const char_t* name, const xml_node& node);
+xml_node xml_node::insert_child_after(string_view_t name, const xml_node& node); +xml_node xml_node::insert_child_before(const char_t* name, const xml_node& node); +xml_node xml_node::insert_child_before(string_view_t name, const xml_node& node);
@@ -2927,7 +2949,9 @@ If you do not want your document to contain some node or attribute, you can remo
bool xml_node::remove_attribute(const char_t* name);
-bool xml_node::remove_child(const char_t* name);
+bool xml_node::remove_attribute(string_view_t name); +bool xml_node::remove_child(const char_t* name); +bool xml_node::remove_child(string_view_t name);
@@ -2963,7 +2987,8 @@ If you do not want your document to contain some node or attribute, you can remo
bool xml_text::set(const char_t* rhs);
-bool xml_text::set(const char_t* rhs, size_t size);
+bool xml_text::set(const char_t* rhs, size_t size); +bool xml_text::set(string_view_t rhs);
@@ -2996,6 +3021,7 @@ If you do not want your document to contain some node or attribute, you can remo
xml_text& xml_text::operator=(const char_t* rhs);
+xml_text& xml_text::operator=(string_view_t rhs);
 xml_text& xml_text::operator=(int rhs);
 xml_text& xml_text::operator=(unsigned int rhs);
 xml_text& xml_text::operator=(long rhs);
@@ -3993,7 +4019,7 @@ By default, XPath functions throw xpath_exception object in case of
 
-
virtual const char* xpath_exception::what() const throw();
+
virtual const char* xpath_exception::what() const noexcept;
 const xpath_parse_result& xpath_exception::result() const;
@@ -5672,7 +5698,8 @@ If exceptions are disabled, then in the event of parsing failure the query is in #define PUGIXML_MEMORY_OUTPUT_STACK #define PUGIXML_MEMORY_XPATH_PAGE_SIZE #define PUGIXML_HEADER_ONLY -#define PUGIXML_HAS_LONG_LONG +#define PUGIXML_HAS_LONG_LONG +#define PUGIXML_HAS_STRING_VIEW
@@ -5682,6 +5709,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
typedef configuration-defined-type char_t;
 typedef configuration-defined-type string_t;
+typedef configuration-defined-type string_view_t;
 typedef void* (*allocation_function)(size_t size);
 typedef void (*deallocation_function)(void* ptr);
@@ -5817,8 +5845,10 @@ If exceptions are disabled, then in the event of parsing failure the query is in bool set_name(const char_t* rhs); bool set_name(const char_t* rhs, size_t size); + bool set_name(string_view_t rhs); bool set_value(const char_t* rhs); bool set_value(const char_t* rhs, size_t size); + bool set_value(string_view_t rhs); bool set_value(int rhs); bool set_value(unsigned int rhs); bool set_value(long rhs); @@ -5830,6 +5860,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in bool set_value(unsigned long long rhs); xml_attribute& operator=(const char_t* rhs); + xml_attribute& operator=(string_view_t rhs); xml_attribute& operator=(int rhs); xml_attribute& operator=(unsigned int rhs); xml_attribute& operator=(long rhs); @@ -5874,11 +5905,16 @@ If exceptions are disabled, then in the event of parsing failure the query is in implementation-defined-type attributes() const; xml_node child(const char_t* name) const; + xml_node child(string_view_t name) const; xml_attribute attribute(const char_t* name) const; + xml_attribute attribute(string_view_t name) const; xml_node next_sibling(const char_t* name) const; + xml_node next_sibling(string_view_t name) const; xml_node previous_sibling(const char_t* name) const; + xml_node previous_sibling(string_view_t name) const; xml_attribute attribute(const char_t* name, xml_attribute& hint) const; + xml_attribute attribute(string_view_t name, xml_attribute& hint) const; xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const; xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const; @@ -5908,13 +5944,19 @@ If exceptions are disabled, then in the event of parsing failure the query is in bool set_name(const char_t* rhs); bool set_name(const char_t* rhs, size_t size); + bool set_name(string_view_t rhs); bool set_value(const char_t* rhs); bool set_value(const char_t* rhs, size_t size); + bool set_value(string_view_t rhs); xml_attribute append_attribute(const char_t* name); + xml_attribute append_attribute(string_view_t name); xml_attribute prepend_attribute(const char_t* name); + xml_attribute prepend_attribute(string_view_t name); xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr); + xml_attribute insert_attribute_after(string_view_t name, const xml_attribute& attr); xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr); + xml_attribute insert_attribute_before(string_view_t name, const xml_attribute& attr); xml_node append_child(xml_node_type type = node_element); xml_node prepend_child(xml_node_type type = node_element); @@ -5922,9 +5964,13 @@ If exceptions are disabled, then in the event of parsing failure the query is in xml_node insert_child_before(xml_node_type type, const xml_node& node); xml_node append_child(const char_t* name); + xml_node append_child(string_view_t name); xml_node prepend_child(const char_t* name); + xml_node prepend_child(string_view_t name); xml_node insert_child_after(const char_t* name, const xml_node& node); + xml_node insert_child_after(string_view_t name, const xml_node& node); xml_node insert_child_before(const char_t* name, const xml_node& node); + xml_node insert_child_before(string_view_t name, const xml_node& node); xml_attribute append_copy(const xml_attribute& proto); xml_attribute prepend_copy(const xml_attribute& proto); @@ -5943,9 +5989,11 @@ If exceptions are disabled, then in the event of parsing failure the query is in bool remove_attribute(const xml_attribute& a); bool remove_attribute(const char_t* name); + bool remove_attribute(string_view_t name); bool remove_attributes(); bool remove_child(const xml_node& n); bool remove_child(const char_t* name); + bool remove_child(string_view_t name); bool remove_children(); xml_parse_result append_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto); @@ -6023,6 +6071,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in bool set(const char_t* rhs); bool set(const char_t* rhs, size_t size); + bool set(string_view_t rhs); bool set(int rhs); bool set(unsigned int rhs); @@ -6035,6 +6084,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in bool set(unsigned long long rhs); xml_text& operator=(const char_t* rhs); + xml_text& operator=(string_view_t rhs); xml_text& operator=(int rhs); xml_text& operator=(unsigned int rhs); xml_text& operator=(long rhs); @@ -6080,7 +6130,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in operator unspecified_bool_type() const; class xpath_exception: public std::exception - virtual const char* what() const throw(); + virtual const char* what() const noexcept; const xpath_parse_result& result() const; @@ -6167,7 +6217,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in