From 4f2ad720c867f29f3156b953eadfe9be5efb511a Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 21 Aug 2017 20:52:58 -0700 Subject: docs: Update encoding conversion description We support Latin-1 and automatically detect it by parsing the encoding from document declaration; both of these were omitted from the description of the automatic detection. Additionally, the description has been rewritten to be more concise and a bit more abstract - there's no need to specify the algorithm precisely here. Fixes #158. --- docs/manual.adoc | 14 +- docs/manual.html | 424 +++++++++++++++++++++++++-------------------------- docs/quickstart.html | 49 +++--- 3 files changed, 236 insertions(+), 251 deletions(-) (limited to 'docs') diff --git a/docs/manual.adoc b/docs/manual.adoc index 6688bd6..7f4fc8b 100644 --- a/docs/manual.adoc +++ b/docs/manual.adoc @@ -556,7 +556,7 @@ On 32-bit architectures document structure in compact mode is typically reduced pugixml provides several functions for loading XML data from various places - files, C{plus}{plus} iostreams, memory buffers. All functions use an extremely fast non-validating parser. This parser is not fully W3C conformant - it can load any valid XML document, but does not perform some well-formedness checks. While considerable effort is made to reject invalid XML documents, some validation is not performed for performance reasons. Also some XML transformations (i.e. EOL handling or attribute value normalization) can impact parsing speed and thus can be disabled. However for vast majority of XML documents there is no performance difference between different parsing options. Parsing options also control whether certain XML nodes are parsed; see <> for more information. -XML data is always converted to internal character format (see <>) before parsing. pugixml supports all popular Unicode encodings (UTF-8, UTF-16 (big and little endian), UTF-32 (big and little endian); UCS-2 is naturally supported since it's a strict subset of UTF-16) and handles all encoding conversions automatically. Unless explicit encoding is specified, loading functions perform automatic encoding detection based on first few characters of XML data, so in almost all cases you do not have to specify document encoding. Encoding conversion is described in more detail in <>. +XML data is always converted to internal character format (see <>) before parsing. pugixml supports all popular Unicode encodings (UTF-8, UTF-16 (big and little endian), UTF-32 (big and little endian); UCS-2 is naturally supported since it's a strict subset of UTF-16) as well as some non-Unicode encodings (Latin-1) and handles all encoding conversions automatically. Unless explicit encoding is specified, loading functions perform automatic encoding detection based on source XML data, so in most cases you do not have to specify document encoding. Encoding conversion is described in more detail in <>. [[loading.file]] === Loading document from file @@ -784,17 +784,9 @@ include::samples/load_options.cpp[tags=code] === Encodings [[xml_encoding]] -pugixml supports all popular Unicode encodings (UTF-8, UTF-16 (big and little endian), UTF-32 (big and little endian); UCS-2 is naturally supported since it's a strict subset of UTF-16) and handles all encoding conversions. Most loading functions accept the optional parameter `encoding`. This is a value of enumeration type `xml_encoding`, that can have the following values: - -* [[encoding_auto]]`encoding_auto` means that pugixml will try to guess the encoding based on source XML data. The algorithm is a modified version of the one presented in http://www.w3.org/TR/REC-xml/#sec-guessing-no-ext-info[Appendix F.1 of XML recommendation]; it tries to match the first few bytes of input data with the following patterns in strict order: -** If first four bytes match UTF-32 BOM (Byte Order Mark), encoding is assumed to be UTF-32 with the endianness equal to that of BOM; -** If first two bytes match UTF-16 BOM, encoding is assumed to be UTF-16 with the endianness equal to that of BOM; -** If first three bytes match UTF-8 BOM, encoding is assumed to be UTF-8; -** If first four bytes match UTF-32 representation of `<`, encoding is assumed to be UTF-32 with the corresponding endianness; -** If first four bytes match UTF-16 representation of ` - + pugixml 1.8 manual @@ -90,13 +90,12 @@ strong,b{font-weight:bold;line-height:inherit} small{font-size:60%;line-height:inherit} code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)} ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit} -ul,ol,ul.no-bullet,ol.no-bullet{margin-left:1.5em} +ul,ol{margin-left:1.5em} ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em} ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit} ul.square{list-style-type:square} ul.circle{list-style-type:circle} ul.disc{list-style-type:disc} -ul.no-bullet{list-style:none} ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0} dl dt{margin-bottom:.3125em;font-weight:bold} dl dd{margin-bottom:1.25em} @@ -132,7 +131,11 @@ strong strong{font-weight:400} kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap} .keyseq kbd:first-child{margin-left:0} .keyseq kbd:last-child{margin-right:0} -.menuseq,.menu{color:rgba(0,0,0,.8)} +.menuseq,.menuref{color:#000} +.menuseq b:not(.caret),.menuref{font-weight:inherit} +.menuseq{word-spacing:-.02em} +.menuseq b.caret{font-size:1.25em;line-height:.8} +.menuseq i.caret{font-weight:bold;text-align:center;width:.45em} b.button:before,b.button:after{position:relative;top:-1px;font-weight:400} b.button:before{content:"[";padding:0 3px 0 2px} b.button:after{content:"]";padding:0 2px 0 3px} @@ -199,7 +202,7 @@ table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0} table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit} .admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%} .admonitionblock>table td.icon{text-align:center;width:80px} -.admonitionblock>table td.icon img{max-width:none} +.admonitionblock>table td.icon img{max-width:initial} .admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase} .admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)} .admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0} @@ -255,13 +258,13 @@ table.pyhltable .linenodiv{background:none!important;padding-right:0!important} table.tableblock{max-width:100%;border-collapse:separate} table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0} table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede} -table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0} -table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0} -table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0} -table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0} -table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0} -table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0} -table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0} +table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0} +table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0} +table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0} +table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px 0} +table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0 0} +table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0} +table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0} table.frame-all{border-width:1px} table.frame-sides{border-width:0 1px} table.frame-topbot{border-width:1px 0} @@ -282,10 +285,12 @@ ul li ol{margin-left:1.5em} dl dd{margin-left:1.125em} dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0} ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em} -ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none} -ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em} -ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:.85em} -ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px} +ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none} +ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em} +ul.unstyled,ol.unstyled{margin-left:0} +ul.checklist{margin-left:.625em} +ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em} +ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em} ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden} ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block} ul.inline>li>*{display:block} @@ -302,7 +307,8 @@ ol.lowergreek{list-style-type:lower-greek} td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em} td.hdlist1{font-weight:bold;padding-bottom:1.25em} .literalblock+.colist,.listingblock+.colist{margin-top:-.5em} -.colist>table tr>td:first-of-type{padding:0 .75em;line-height:1} +.colist>table tr>td:first-of-type{padding:.4em .75em 0 .75em;line-height:1;vertical-align:top} +.colist>table tr>td:first-of-type img{max-width:initial} .colist>table tr>td:last-of-type{padding:.25em 0} .thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd} .imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0} @@ -365,6 +371,7 @@ div.unbreakable{page-break-inside:avoid} .yellow{color:#bfbf00} .yellow-background{background-color:#fafa00} span.icon>.fa{cursor:default} +a span.icon>.fa{cursor:inherit} .admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default} .admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c} .admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111} @@ -425,8 +432,10 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b .listingblock .pygments .tok-err { border: 1px solid #FF0000 } /* Error */ .listingblock .pygments .tok-k { color: #008000; font-weight: bold } /* Keyword */ .listingblock .pygments .tok-o { color: #666666 } /* Operator */ +.listingblock .pygments .tok-ch { color: #408080; font-style: italic } /* Comment.Hashbang */ .listingblock .pygments .tok-cm { color: #408080; font-style: italic } /* Comment.Multiline */ .listingblock .pygments .tok-cp { color: #BC7A00 } /* Comment.Preproc */ +.listingblock .pygments .tok-cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */ .listingblock .pygments .tok-c1 { color: #408080; font-style: italic } /* Comment.Single */ .listingblock .pygments .tok-cs { color: #408080; font-style: italic } /* Comment.Special */ .listingblock .pygments .tok-gd { color: #A00000 } /* Generic.Deleted */ @@ -534,28 +543,28 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • 5. Accessing document data
  • 6. Modifying document data
  • 7. Saving document @@ -680,7 +689,7 @@ No documentation is perfect; neither is this one. If you find errors or omission
    -
    Copyright (c) 2006-2016 Arseny Kapoulkine
    +
    Copyright (c) 2006-2017 Arseny Kapoulkine
     
     Permission is hereby granted, free of charge, to any person
     obtaining a copy of this software and associated documentation
    @@ -710,7 +719,7 @@ OTHER DEALINGS IN THE SOFTWARE.
    This software is based on pugixml library (http://pugixml.org).
    -pugixml is Copyright (C) 2006-2016 Arseny Kapoulkine.
    +pugixml is Copyright (C) 2006-2017 Arseny Kapoulkine.
    @@ -1466,7 +1475,7 @@ You can use the following accessor functions to change or get current memory man

    pugixml provides several functions for loading XML data from various places - files, C++ iostreams, memory buffers. All functions use an extremely fast non-validating parser. This parser is not fully W3C conformant - it can load any valid XML document, but does not perform some well-formedness checks. While considerable effort is made to reject invalid XML documents, some validation is not performed for performance reasons. Also some XML transformations (i.e. EOL handling or attribute value normalization) can impact parsing speed and thus can be disabled. However for vast majority of XML documents there is no performance difference between different parsing options. Parsing options also control whether certain XML nodes are parsed; see Parsing options for more information.

    -

    XML data is always converted to internal character format (see Unicode interface) before parsing. pugixml supports all popular Unicode encodings (UTF-8, UTF-16 (big and little endian), UTF-32 (big and little endian); UCS-2 is naturally supported since it’s a strict subset of UTF-16) and handles all encoding conversions automatically. Unless explicit encoding is specified, loading functions perform automatic encoding detection based on first few characters of XML data, so in almost all cases you do not have to specify document encoding. Encoding conversion is described in more detail in Encodings.

    +

    XML data is always converted to internal character format (see Unicode interface) before parsing. pugixml supports all popular Unicode encodings (UTF-8, UTF-16 (big and little endian), UTF-32 (big and little endian); UCS-2 is naturally supported since it’s a strict subset of UTF-16) as well as some non-Unicode encodings (Latin-1) and handles all encoding conversions automatically. Unless explicit encoding is specified, loading functions perform automatic encoding detection based on source XML data, so in most cases you do not have to specify document encoding. Encoding conversion is described in more detail in Encodings.

    4.1. Loading document from file

    @@ -1529,7 +1538,7 @@ Sometimes XML data should be loaded from some other source than a file, i.e. HTT
    -
    xml_parse_result xml_document::load_string(const char_t* contents, unsigned int options = parse_default);
    +
    xml_parse_result xml_document::load_string(const char_t* contents, unsigned int options = parse_default);
    @@ -1621,8 +1630,8 @@ Sometimes XML data should be loaded from some other source than a file, i.e. HTT ptrdiff_t offset; xml_encoding encoding; - operator bool() const; - const char* description() const; + operator bool() const; + const char* description() const; };
    @@ -1863,37 +1872,12 @@ Using in-place parsing (load_buffer

    4.6. Encodings

    -

    pugixml supports all popular Unicode encodings (UTF-8, UTF-16 (big and little endian), UTF-32 (big and little endian); UCS-2 is naturally supported since it’s a strict subset of UTF-16) and handles all encoding conversions. Most loading functions accept the optional parameter encoding. This is a value of enumeration type xml_encoding, that can have the following values:

    +

    pugixml supports all popular Unicode encodings (UTF-8, UTF-16 (big and little endian), UTF-32 (big and little endian); UCS-2 is naturally supported since it’s a strict subset of UTF-16) as well as some non-Unicode encodings (Latin-1) and handles all encoding conversions. Most loading functions accept the optional parameter encoding. This is a value of enumeration type xml_encoding, that can have the following values:

    • -

      encoding_auto means that pugixml will try to guess the encoding based on source XML data. The algorithm is a modified version of the one presented in Appendix F.1 of XML recommendation; it tries to match the first few bytes of input data with the following patterns in strict order:

      -
      -
        -
      • -

        If first four bytes match UTF-32 BOM (Byte Order Mark), encoding is assumed to be UTF-32 with the endianness equal to that of BOM;

        -
      • -
      • -

        If first two bytes match UTF-16 BOM, encoding is assumed to be UTF-16 with the endianness equal to that of BOM;

        -
      • -
      • -

        If first three bytes match UTF-8 BOM, encoding is assumed to be UTF-8;

        -
      • -
      • -

        If first four bytes match UTF-32 representation of <, encoding is assumed to be UTF-32 with the corresponding endianness;

        -
      • -
      • -

        If first four bytes match UTF-16 representation of <?, encoding is assumed to be UTF-16 with the corresponding endianness;

        -
      • -
      • -

        If first two bytes match UTF-16 representation of <, encoding is assumed to be UTF-16 with the corresponding endianness (this guess may yield incorrect result, but it’s better than UTF-8);

        -
      • -
      • -

        Otherwise encoding is assumed to be UTF-8.

        -
      • -
      -
      +

      encoding_auto means that pugixml will try to guess the encoding based on source XML data. The algorithm is a modified version of the one presented in Appendix F of XML recommendation. It tries to find a Byte Order Mark of one of the supported encodings first; if that fails, it checks if the first few bytes of the input data look like a representation of < or <? in one of UTF-16 or UTF-32 variants; if that fails as well, encoding is assumed to be either UTF-8 or one of the non-Unicode encodings - to make the final decision the algorithm tries to parse the encoding attribute of the XML document declaration, ultimately falling back to UTF-8 if document declaration is not present or does not specify a supported encoding.

    • encoding_utf8 corresponds to UTF-8 encoding as defined in the Unicode standard; UTF-8 sequences with length equal to 5 or 6 are not standard and are rejected.

      @@ -1986,7 +1970,7 @@ The current behavior for Unicode conversion is to skip all invalid UTF sequences

      pugixml features an extensive interface for getting various types of data from the document and for traversing the document. This section provides documentation for all such functions that do not modify the tree except for XPath-related functions; see XPath for XPath reference. As discussed in C++ interface, there are two types of handles to tree data - xml_node and xml_attribute. The handles have special null (empty) values which propagate through various functions and thus are useful for writing more concise code; see this description for details. The documentation in this section will explicitly state the results of all function in case of null inputs.

    -

    5.1. Basic traversal functions

    +

    Basic traversal functions

    The internal representation of the document is a tree, where each node has a list of child nodes (the order of children corresponds to their order in the XML representation), and additionally element nodes have a list of attributes, which is also ordered. Several functions are provided in order to let you get from one node in the tree to the other. These functions roughly correspond to the internal representation, and thus are usually building blocks for other methods of traversing (i.e. XPath traversals are based on these functions).

    @@ -2043,15 +2027,15 @@ Because of memory consumption reasons, attributes do not have a link to their pa
    -

    5.2. Getting node data

    +

    5.1. Getting node data

    Apart from structural information (parent, child nodes, attributes), nodes can have name and value, both of which are strings. Depending on node type, name or value may be absent. node_document nodes do not have a name or value, node_element and node_declaration nodes always have a name but never have a value, node_pcdata, node_cdata, node_comment and node_doctype nodes never have a name but always have a value (it may be empty though), node_pi nodes always have a name and a value (again, value may be empty). In order to get node’s name or value, you can use the following functions:

    -
    const char_t* xml_node::name() const;
    -const char_t* xml_node::value() const;
    +
    const char_t* xml_node::name() const;
    +const char_t* xml_node::value() const;
    @@ -2062,8 +2046,8 @@ Apart from structural information (parent, child nodes, attributes), nodes can h
    -
    const char_t* xml_node::child_value() const;
    -const char_t* xml_node::child_value(const char_t* name) const;
    +
    const char_t* xml_node::child_value() const;
    +const char_t* xml_node::child_value(const char_t* name) const;
     xml_text xml_node::text() const;
    @@ -2078,15 +2062,15 @@ Apart from structural information (parent, child nodes, attributes), nodes can h
    -

    5.3. Getting attribute data

    +

    5.2. Getting attribute data

    All attributes have name and value, both of which are strings (value may be empty). There are two corresponding accessors, like for xml_node:

    -
    const char_t* xml_attribute::name() const;
    -const char_t* xml_attribute::value() const;
    +
    const char_t* xml_attribute::name() const;
    +const char_t* xml_attribute::value() const;
    @@ -2097,7 +2081,7 @@ All attributes have name and value, both of which are strings (value may be empt
    -
    const char_t* xml_attribute::as_string(const char_t* def = "") const;
    +
    const char_t* xml_attribute::as_string(const char_t* def = "") const;
    @@ -2167,17 +2151,17 @@ Number conversion functions depend on current C locale as set with setloca
    -

    5.4. Contents-based traversal functions

    +

    5.3. Contents-based traversal functions

    Since a lot of document traversal consists of finding the node/attribute with the correct name, there are special functions for that purpose:

    -
    xml_node xml_node::child(const char_t* name) const;
    -xml_attribute xml_node::attribute(const char_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::child(const char_t* name) const;
    +xml_attribute xml_node::attribute(const char_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;
    @@ -2196,8 +2180,8 @@ Since a lot of document traversal consists of finding the node/attribute with th
    -
    xml_node xml_node::find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
    -xml_node xml_node::find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
    +
    xml_node xml_node::find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
    +xml_node xml_node::find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
    @@ -2221,7 +2205,7 @@ Since a lot of document traversal consists of finding the node/attribute with th
    -

    5.5. Range-based for-loop support

    +

    5.4. Range-based for-loop support

    If your C++ compiler supports range-based for-loop (this is a C++11 feature, at the time of writing it’s supported by Microsoft Visual Studio 2012+, GCC 4.6+ and Clang 3.0+), you can use it to enumerate nodes/attributes. Additional helpers are provided to support this; note that they are also compatible with Boost Foreach, and possibly other pre-C++11 foreach facilities.

    @@ -2229,7 +2213,7 @@ If your C++ compiler supports range-based for-loop (this is a C++
    implementation-defined-type xml_node::children() const;
    -implementation-defined-type xml_node::children(const char_t* name) const;
    +implementation-defined-type xml_node::children(const char_t* name) const;
     implementation-defined-type xml_node::attributes() const;
    @@ -2261,7 +2245,7 @@ If your C++ compiler supports range-based for-loop (this is a C++
    -

    5.6. Traversing node/attribute lists via iterators

    +

    5.5. Traversing node/attribute lists via iterators

    Child node lists and attribute lists are simply double-linked lists; while you can use previous_sibling/next_sibling and other such functions for iteration, pugixml additionally provides node and attribute iterators, so that you can treat nodes as containers of other nodes or attributes:

    @@ -2321,7 +2305,7 @@ Node and attribute iterators are somewhere in the middle between const and non-c
    -

    5.7. Recursive traversal with xml_tree_walker

    +

    5.6. Recursive traversal with xml_tree_walker

    The methods described above allow traversal of immediate children of some node; if you want to do a deep tree traversal, you’ll have to do it via a recursive function or some equivalent method. However, pugixml provides a helper for depth-first traversal of a subtree. In order to use it, you have to implement xml_tree_walker interface and to call traverse function:

    @@ -2331,10 +2315,10 @@ Node and attribute iterators are somewhere in the middle between const and non-c { public: virtual bool begin(xml_node& node); - virtual bool for_each(xml_node& node) = 0; + virtual bool for_each(xml_node& node) = 0; virtual bool end(xml_node& node); - int depth() const; + int depth() const; }; bool xml_node::traverse(xml_tree_walker& walker);
    @@ -2389,7 +2373,7 @@ The traversal is launched by calling traverse function on traversal
    -

    5.8. Searching for nodes/attributes with predicates

    +

    5.7. Searching for nodes/attributes with predicates

    While there are existing functions for getting a node/attribute with known contents, they are often not sufficient for simple queries. As an alternative for manual iteration through nodes/attributes until the needed one is found, you can make a predicate and call one of find_ functions:

    @@ -2454,7 +2438,7 @@ While there are existing functions for getting a node/attribute with known conte
    -

    5.9. Working with text contents

    +

    5.8. Working with text contents

    It is common to store data as text contents of some node - i.e. <node><description>This is a node</description></node>. In this case, <description> node does not have a value, but instead has a child of type node_pcdata with value "This is a node". pugixml provides a special class, xml_text, to work with such data. Working with text objects to modify data is described in the documentation for modifying document data; this section describes the access interface of xml_text.

    @@ -2483,7 +2467,7 @@ You can check if the text object is bound to a valid PCDATA/CDATA node by using
    -
    const char_t* xml_text::get() const;
    +
    const char_t* xml_text::get() const;
    @@ -2495,7 +2479,7 @@ If you need a non-empty string if the text object is empty, or if the text conte
    -
    const char_t* xml_text::as_string(const char_t* def = "") const;
    +
    const char_t* xml_text::as_string(const char_t* def = "") const;
     int xml_text::as_int(int def = 0) const;
     unsigned int xml_text::as_uint(unsigned int def = 0) const;
     double xml_text::as_double(double def = 0) const;
    @@ -2532,7 +2516,7 @@ If you need a non-empty string if the text object is empty, or if the text conte
     
    -

    5.10. Miscellaneous functions

    +

    5.9. Miscellaneous functions

    If you need to get the document root of some node, you can use the following function:

    @@ -2550,8 +2534,8 @@ While pugixml supports complex XPath expressions, sometimes a simple path handli
    -
    string_t xml_node::path(char_t delimiter = '/') const;
    -xml_node xml_node::first_element_by_path(const char_t* path, char_t delimiter = '/') const;
    +
    string_t xml_node::path(char_t delimiter = '/') const;
    +xml_node xml_node::first_element_by_path(const char_t* path, char_t delimiter = '/') const;
    @@ -2596,15 +2580,15 @@ While pugixml supports complex XPath expressions, sometimes a simple path handli

    All member functions that change node/attribute data or structure are non-constant and thus can not be called on constant handles. However, you can easily convert constant handle to non-constant one by simple assignment: void foo(const pugi::xml_node& n) { pugi::xml_node nc = n; }, so const-correctness here mainly provides additional documentation.

    -

    6.1. Setting node data

    +

    Setting node data

    As discussed before, nodes can have name and value, both of which are strings. Depending on node type, name or value may be absent. node_document nodes do not have a name or value, node_element and node_declaration nodes always have a name but never have a value, node_pcdata, node_cdata, node_comment and node_doctype nodes never have a name but always have a value (it may be empty though), node_pi nodes always have a name and a value (again, value may be empty). In order to set node’s name or value, you can use the following functions:

    -
    bool xml_node::set_name(const char_t* rhs);
    -bool xml_node::set_value(const char_t* rhs);
    +
    bool xml_node::set_name(const char_t* rhs);
    +bool xml_node::set_value(const char_t* rhs);
    @@ -2631,15 +2615,15 @@ As discussed before, nodes can have name and value, both of which are strings. D
    -

    6.2. Setting attribute data

    +

    6.1. Setting attribute data

    All attributes have name and value, both of which are strings (value may be empty). You can set them with the following functions:

    -
    bool xml_attribute::set_name(const char_t* rhs);
    -bool xml_attribute::set_value(const char_t* rhs);
    +
    bool xml_attribute::set_name(const char_t* rhs);
    +bool xml_attribute::set_value(const char_t* rhs);
    @@ -2693,7 +2677,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=(const char_t* rhs);
     xml_attribute& xml_attribute::operator=(int rhs);
     xml_attribute& xml_attribute::operator=(unsigned int rhs);
     xml_attribute& xml_attribute::operator=(long rhs);
    @@ -2730,27 +2714,27 @@ Number conversion functions depend on current C locale as set with setloca
     
    -

    6.3. Adding nodes/attributes

    +

    6.2. Adding nodes/attributes

    Nodes and attributes do not exist without a document tree, so you can’t create them without adding them to some document. A node or attribute can be created at the end of node/attribute list or before/after some other node:

    -
    xml_attribute xml_node::append_attribute(const char_t* name);
    -xml_attribute xml_node::prepend_attribute(const char_t* name);
    -xml_attribute xml_node::insert_attribute_after(const char_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::append_attribute(const char_t* name);
    +xml_attribute xml_node::prepend_attribute(const char_t* name);
    +xml_attribute xml_node::insert_attribute_after(const char_t* name, const xml_attribute& attr);
    +xml_attribute xml_node::insert_attribute_before(const char_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);
     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::prepend_child(const char_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::append_child(const char_t* name); +xml_node xml_node::prepend_child(const char_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);
    @@ -2825,7 +2809,7 @@ Nodes and attributes do not exist without a document tree, so you can’t cr
    -

    6.4. Removing nodes/attributes

    +

    6.3. Removing nodes/attributes

    If you do not want your document to contain some node or attribute, you can remove it with one of the following functions:

    @@ -2860,8 +2844,8 @@ 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(const char_t* name);
    +bool xml_node::remove_child(const char_t* name);
    @@ -2887,7 +2871,7 @@ If you do not want your document to contain some node or attribute, you can remo
    -

    6.5. Working with text contents

    +

    6.4. Working with text contents

    pugixml provides a special class, xml_text, to work with text contents stored as a value of some node, i.e. <node><description>This is a node</description></node>. Working with text objects to retrieve data is described in the documentation for accessing document data; this section describes the modification interface of xml_text.

    @@ -2896,7 +2880,7 @@ 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);
    @@ -2926,7 +2910,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=(const char_t* rhs);
     xml_text& xml_text::operator=(int rhs);
     xml_text& xml_text::operator=(unsigned int rhs);
     xml_text& xml_text::operator=(long rhs);
    @@ -2956,7 +2940,7 @@ If you do not want your document to contain some node or attribute, you can remo
     
    -

    6.6. Cloning nodes/attributes

    +

    6.5. Cloning nodes/attributes

    With the help of previously described functions, it is possible to create trees with any contents and structure, including cloning the existing data. However since this is an often needed operation, pugixml provides built-in node/attribute cloning facilities. Since nodes and attributes do not exist without a document tree, you can’t create a standalone copy - you have to immediately insert it somewhere in the tree. For this, you can use one of the following functions:

    @@ -3052,7 +3036,7 @@ With the help of previously described functions, it is possible to create trees
    -

    6.7. Moving nodes

    +

    6.6. Moving nodes

    Sometimes instead of cloning a node you need to move an existing node to a different position in a tree. This can be accomplished by copying the node and removing the original; however, this is expensive since it results in a lot of extra operations. For moving nodes within the same document tree, you can use of the following functions instead:

    @@ -3089,7 +3073,7 @@ Sometimes instead of cloning a node you need to move an existing node to a diffe
    -

    6.8. Assembling document from fragments

    +

    6.7. Assembling document from fragments

    pugixml provides several ways to assemble an XML document from other XML documents. Assuming there is a set of document fragments, represented as in-memory buffers, the implementation choices are as follows:

    @@ -3164,8 +3148,8 @@ If you want to save the whole document to a file, you can use one of the followi
    -
    bool xml_document::save_file(const char* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    -bool xml_document::save_file(const wchar_t* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    +
    bool xml_document::save_file(const char* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    +bool xml_document::save_file(const wchar_t* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    @@ -3194,8 +3178,8 @@ If you want to save the whole document to a file, you can use one of the followi
    -
    void xml_document::save(std::ostream& stream, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    -void xml_document::save(std::wostream& stream, const char_t* indent = "\t", unsigned int flags = format_default) const;
    +
    void xml_document::save(std::ostream& stream, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    +void xml_document::save(std::wostream& stream, const char_t* indent = "\t", unsigned int flags = format_default) const;
    @@ -3229,7 +3213,7 @@ All of the above saving functions are implemented in terms of writer interface. virtual void write(const void* data, size_t size) = 0; }; -void xml_document::save(xml_writer& writer, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const; +void xml_document::save(xml_writer& writer, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    @@ -3263,9 +3247,9 @@ While the previously described functions save the whole document to the destinat
    -
    void xml_node::print(std::ostream& os, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
    -void xml_node::print(std::wostream& os, const char_t* indent = "\t", unsigned int flags = format_default, unsigned int depth = 0) const;
    -void xml_node::print(xml_writer& writer, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
    +
    void xml_node::print(std::ostream& os, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
    +void xml_node::print(std::wostream& os, const char_t* indent = "\t", unsigned int flags = format_default, unsigned int depth = 0) const;
    +void xml_node::print(xml_writer& writer, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
    @@ -3552,8 +3536,8 @@ The order of iteration depends on the order of nodes inside the set; the order c
    -
    enum xpath_node_set::type_t {type_unsorted, type_sorted, type_sorted_reverse};
    -type_t xpath_node_set::type() const;
    +
    enum xpath_node_set::type_t {type_unsorted, type_sorted, type_sorted_reverse};
    +type_t xpath_node_set::type() const;
    @@ -3583,7 +3567,7 @@ The order of iteration depends on the order of nodes inside the set; the order c
    -
    xpath_node_set::xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
    +
    xpath_node_set::xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
    @@ -3598,8 +3582,8 @@ If you want to select nodes that match some XPath expression, you can do it with
    -
    xpath_node xml_node::select_node(const char_t* query, xpath_variable_set* variables = 0) const;
    -xpath_node_set xml_node::select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
    +
    xpath_node xml_node::select_node(const char_t* query, xpath_variable_set* variables = 0) const;
    +xpath_node_set xml_node::select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
    @@ -3669,7 +3653,7 @@ While compiling expressions is fast, the compilation time can introduce a signif
    -
    explicit xpath_query::xpath_query(const char_t* query, xpath_variable_set* variables = 0);
    +
    explicit xpath_query::xpath_query(const char_t* query, xpath_variable_set* variables = 0);
    @@ -3688,7 +3672,7 @@ You can evaluate the query using one of the following functions:

    bool xpath_query::evaluate_boolean(const xpath_node& n) const;
     double xpath_query::evaluate_number(const xpath_node& n) const;
    -string_t xpath_query::evaluate_string(const xpath_node& n) const;
    +string_t xpath_query::evaluate_string(const xpath_node& n) const;
     xpath_node_set xpath_query::evaluate_node_set(const xpath_node& n) const;
     xpath_node xpath_query::evaluate_node(const xpath_node& n) const;
    @@ -3713,7 +3697,7 @@ Calling node.select_nodes("query") is equivalent to calling x
    -
    size_t xpath_query::evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
    +
    size_t xpath_query::evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
    @@ -3768,9 +3752,9 @@ Calling node.select_nodes("query") is equivalent to calling x
    -
    explicit xpath_query::xpath_query(const char_t* query, xpath_variable_set* variables = 0);
    -xpath_node xml_node::select_node(const char_t* query, xpath_variable_set* variables = 0) const;
    -xpath_node_set xml_node::select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
    +
    explicit xpath_query::xpath_query(const char_t* query, xpath_variable_set* variables = 0);
    +xpath_node xml_node::select_node(const char_t* query, xpath_variable_set* variables = 0) const;
    +xpath_node_set xml_node::select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
    @@ -3796,7 +3780,7 @@ The variable set pointer is stored in the query object; you have to ensure that
    -
    xpath_variable* xpath_variable_set::add(const char_t* name, xpath_value_type type);
    +
    xpath_variable* xpath_variable_set::add(const char_t* name, xpath_value_type type);
    @@ -3810,8 +3794,8 @@ The variable set pointer is stored in the query object; you have to ensure that
    -
    xpath_variable* xpath_variable_set::get(const char_t* name);
    -const xpath_variable* xpath_variable_set::get(const char_t* name) const;
    +
    xpath_variable* xpath_variable_set::get(const char_t* name);
    +const xpath_variable* xpath_variable_set::get(const char_t* name) const;
    @@ -3822,10 +3806,10 @@ The variable set pointer is stored in the query object; you have to ensure that
    -
    bool xpath_variable_set::set(const char_t* name, bool value);
    -bool xpath_variable_set::set(const char_t* name, double value);
    -bool xpath_variable_set::set(const char_t* name, const char_t* value);
    -bool xpath_variable_set::set(const char_t* name, const xpath_node_set& value);
    +
    bool xpath_variable_set::set(const char_t* name, bool value);
    +bool xpath_variable_set::set(const char_t* name, double value);
    +bool xpath_variable_set::set(const char_t* name, const char_t* value);
    +bool xpath_variable_set::set(const char_t* name, const xpath_node_set& value);
    @@ -3840,7 +3824,7 @@ In order to get variable information, you can use one of the following functions
    -
    const char_t* xpath_variable::name() const;
    +
    const char_t* xpath_variable::name() const;
     xpath_value_type xpath_variable::type() const;
    @@ -3855,7 +3839,7 @@ In order to get variable value, you should use one of the following functions, d
    bool xpath_variable::get_boolean() const;
     double xpath_variable::get_number() const;
    -const char_t* xpath_variable::get_string() const;
    +const char_t* xpath_variable::get_string() const;
     const xpath_node_set& xpath_variable::get_node_set() const;
    @@ -3869,7 +3853,7 @@ In order to get variable value, you should use one of the following functions, d
    bool xpath_variable::set(bool value);
     bool xpath_variable::set(double value);
    -bool xpath_variable::set(const char_t* value);
    +bool xpath_variable::set(const char_t* value);
     bool xpath_variable::set(const xpath_node_set& value);
    @@ -3944,8 +3928,8 @@ If exceptions are disabled, then in the event of parsing failure the query is in const char* error; ptrdiff_t offset; - operator bool() const; - const char* description() const; + operator bool() const; + const char* description() const; };
    @@ -3967,7 +3951,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
    // Exception is thrown for incorrect query syntax
    -try
    +try
     {
         doc.select_nodes("//nodes[#true()]");
     }
    @@ -3977,7 +3961,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
     }
     
     // Exception is thrown for incorrect query semantics
    -try
    +try
     {
         doc.select_nodes("(123)/next");
     }
    @@ -3987,7 +3971,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
     }
     
     // Exception is thrown for query with incorrect return type
    -try
    +try
     {
         doc.select_nodes("123");
     }
    @@ -5334,10 +5318,10 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         xml_attribute next_attribute() const;
         xml_attribute previous_attribute() const;
     
    -    const char_t* name() const;
    -    const char_t* value() const;
    +    const char_t* name() const;
    +    const char_t* value() const;
     
    -    const char_t* as_string(const char_t* def = "") const;
    +    const char_t* as_string(const char_t* def = "") const;
         int as_int(int def = 0) const;
         unsigned int as_uint(unsigned int def = 0) const;
         double as_double(double def = 0) const;
    @@ -5346,8 +5330,8 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         long long as_llong(long long def = 0) const;
         unsigned long long as_ullong(unsigned long long def = 0) const;
     
    -    bool set_name(const char_t* rhs);
    -    bool set_value(const char_t* rhs);
    +    bool set_name(const char_t* rhs);
    +    bool set_value(const char_t* rhs);
         bool set_value(int rhs);
         bool set_value(unsigned int rhs);
         bool set_value(long rhs);
    @@ -5358,7 +5342,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         bool set_value(long long rhs);
         bool set_value(unsigned long long rhs);
     
    -    xml_attribute& operator=(const char_t* rhs);
    +    xml_attribute& operator=(const char_t* rhs);
         xml_attribute& operator=(int rhs);
         xml_attribute& operator=(unsigned int rhs);
         xml_attribute& operator=(long rhs);
    @@ -5386,8 +5370,8 @@ If exceptions are disabled, then in the event of parsing failure the query is in
     
         xml_node_type type() const;
     
    -    const char_t* name() const;
    -    const char_t* value() const;
    +    const char_t* name() const;
    +    const char_t* value() const;
     
         xml_node parent() const;
         xml_node first_child() const;
    @@ -5399,18 +5383,18 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         xml_attribute last_attribute() const;
     
         implementation-defined-type children() const;
    -    implementation-defined-type children(const char_t* name) const;
    +    implementation-defined-type children(const char_t* name) const;
         implementation-defined-type attributes() const;
     
    -    xml_node child(const char_t* name) const;
    -    xml_attribute attribute(const char_t* name) const;
    -    xml_node next_sibling(const char_t* name) const;
    -    xml_node previous_sibling(const char_t* name) 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;
    +    xml_node child(const char_t* name) const;
    +    xml_attribute attribute(const char_t* name) const;
    +    xml_node next_sibling(const char_t* name) const;
    +    xml_node previous_sibling(const char_t* name) 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;
     
    -    const char_t* child_value() const;
    -    const char_t* child_value(const char_t* name) const;
    +    const char_t* child_value() const;
    +    const char_t* child_value(const char_t* name) const;
         xml_text text() const;
     
         typedef xml_node_iterator iterator;
    @@ -5427,28 +5411,28 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         template <typename Predicate> xml_node find_child(Predicate pred) const;
         template <typename Predicate> xml_node find_node(Predicate pred) const;
     
    -    string_t path(char_t delimiter = '/') const;
    -    xml_node xml_node::first_element_by_path(const char_t* path, char_t delimiter = '/') const;
    +    string_t path(char_t delimiter = '/') const;
    +    xml_node xml_node::first_element_by_path(const char_t* path, char_t delimiter = '/') const;
         xml_node root() const;
         ptrdiff_t offset_debug() const;
     
    -    bool set_name(const char_t* rhs);
    -    bool set_value(const char_t* rhs);
    +    bool set_name(const char_t* rhs);
    +    bool set_value(const char_t* rhs);
     
    -    xml_attribute append_attribute(const char_t* name);
    -    xml_attribute prepend_attribute(const char_t* name);
    -    xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
    -    xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr);
    +    xml_attribute append_attribute(const char_t* name);
    +    xml_attribute prepend_attribute(const char_t* name);
    +    xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
    +    xml_attribute insert_attribute_before(const char_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);
         xml_node insert_child_after(xml_node_type type, const xml_node& node);
         xml_node insert_child_before(xml_node_type type, const xml_node& node);
     
    -    xml_node append_child(const char_t* name);
    -    xml_node prepend_child(const char_t* name);
    -    xml_node insert_child_after(const char_t* name, const xml_node& node);
    -    xml_node insert_child_before(const char_t* name, const xml_node& node);
    +    xml_node append_child(const char_t* name);
    +    xml_node prepend_child(const char_t* name);
    +    xml_node insert_child_after(const char_t* name, const xml_node& node);
    +    xml_node insert_child_before(const char_t* name, const xml_node& node);
     
         xml_attribute append_copy(const xml_attribute& proto);
         xml_attribute prepend_copy(const xml_attribute& proto);
    @@ -5466,19 +5450,19 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         xml_node insert_move_before(const xml_node& moved, const xml_node& node);
     
         bool remove_attribute(const xml_attribute& a);
    -    bool remove_attribute(const char_t* name);
    +    bool remove_attribute(const char_t* name);
         bool remove_child(const xml_node& n);
    -    bool remove_child(const char_t* name);
    +    bool remove_child(const char_t* name);
     
         xml_parse_result append_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
     
    -    void print(xml_writer& writer, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
    -    void print(std::ostream& os, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
    -    void print(std::wostream& os, const char_t* indent = "\t", unsigned int flags = format_default, unsigned int depth = 0) const;
    +    void print(xml_writer& writer, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
    +    void print(std::ostream& os, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
    +    void print(std::wostream& os, const char_t* indent = "\t", unsigned int flags = format_default, unsigned int depth = 0) const;
     
    -    xpath_node select_node(const char_t* query, xpath_variable_set* variables = 0) const;
    +    xpath_node select_node(const char_t* query, xpath_variable_set* variables = 0) const;
         xpath_node select_node(const xpath_query& query) const;
    -    xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
    +    xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
         xpath_node_set select_nodes(const xpath_query& query) const;
     
     class xml_document
    @@ -5491,7 +5475,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         xml_parse_result load(std::istream& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
         xml_parse_result load(std::wistream& stream, unsigned int options = parse_default);
     
    -    xml_parse_result load_string(const char_t* contents, unsigned int options = parse_default);
    +    xml_parse_result load_string(const char_t* contents, unsigned int options = parse_default);
     
         xml_parse_result load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
         xml_parse_result load_file(const wchar_t* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
    @@ -5500,13 +5484,13 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
         xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
     
    -    bool save_file(const char* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    -    bool save_file(const wchar_t* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    +    bool save_file(const char* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    +    bool save_file(const wchar_t* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
     
    -    void save(std::ostream& stream, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    -    void save(std::wostream& stream, const char_t* indent = "\t", unsigned int flags = format_default) const;
    +    void save(std::ostream& stream, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    +    void save(std::wostream& stream, const char_t* indent = "\t", unsigned int flags = format_default) const;
     
    -    void save(xml_writer& writer, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
    +    void save(xml_writer& writer, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
     
         xml_node document_element() const;
     
    @@ -5532,9 +5516,9 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         bool empty() const;
         operator xml_text::unspecified_bool_type() const;
     
    -    const char_t* xml_text::get() const;
    +    const char_t* xml_text::get() const;
     
    -    const char_t* as_string(const char_t* def = "") const;
    +    const char_t* as_string(const char_t* def = "") const;
         int as_int(int def = 0) const;
         unsigned int as_uint(unsigned int def = 0) const;
         double as_double(double def = 0) const;
    @@ -5543,7 +5527,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         long long as_llong(long long def = 0) const;
         unsigned long long as_ullong(unsigned long long def = 0) const;
     
    -    bool set(const char_t* rhs);
    +    bool set(const char_t* rhs);
     
         bool set(int rhs);
         bool set(unsigned int rhs);
    @@ -5555,7 +5539,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         bool set(long long rhs);
         bool set(unsigned long long rhs);
     
    -    xml_text& operator=(const char_t* rhs);
    +    xml_text& operator=(const char_t* rhs);
         xml_text& operator=(int rhs);
         xml_text& operator=(unsigned int rhs);
         xml_text& operator=(long rhs);
    @@ -5586,12 +5570,12 @@ If exceptions are disabled, then in the event of parsing failure the query is in
         const char* description() const;
     
     class xpath_query
    -    explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
    +    explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
     
         bool evaluate_boolean(const xpath_node& n) const;
         double evaluate_number(const xpath_node& n) const;
    -    string_t evaluate_string(const xpath_node& n) const;
    -    size_t evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
    +    string_t evaluate_string(const xpath_node& n) const;
    +    size_t evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
         xpath_node_set evaluate_node_set(const xpath_node& n) const;
         xpath_node evaluate_node(const xpath_node& n) const;
     
    @@ -5620,7 +5604,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in
     
     class xpath_node_set
         xpath_node_set();
    -    xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
    +    xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
     
         typedef const xpath_node* const_iterator;
         const_iterator begin() const;
    @@ -5632,34 +5616,34 @@ If exceptions are disabled, then in the event of parsing failure the query is in
     
         xpath_node first() const;
     
    -    enum type_t {type_unsorted, type_sorted, type_sorted_reverse};
    -    type_t type() const;
    +    enum type_t {type_unsorted, type_sorted, type_sorted_reverse};
    +    type_t type() const;
         void sort(bool reverse = false);
     
     class xpath_variable
    -    const char_t* name() const;
    +    const char_t* name() const;
         xpath_value_type type() const;
     
         bool get_boolean() const;
         double get_number() const;
    -    const char_t* get_string() const;
    +    const char_t* get_string() const;
         const xpath_node_set& get_node_set() const;
     
         bool set(bool value);
         bool set(double value);
    -    bool set(const char_t* value);
    +    bool set(const char_t* value);
         bool set(const xpath_node_set& value);
     
     class xpath_variable_set
    -    xpath_variable* add(const char_t* name, xpath_value_type type);
    +    xpath_variable* add(const char_t* name, xpath_value_type type);
     
    -    bool set(const char_t* name, bool value);
    -    bool set(const char_t* name, double value);
    -    bool set(const char_t* name, const char_t* value);
    -    bool set(const char_t* name, const xpath_node_set& value);
    +    bool set(const char_t* name, bool value);
    +    bool set(const char_t* name, double value);
    +    bool set(const char_t* name, const char_t* value);
    +    bool set(const char_t* name, const xpath_node_set& value);
     
    -    xpath_variable* get(const char_t* name);
    -    const xpath_variable* get(const char_t* name) const;
    + xpath_variable* get(const char_t* name); + const xpath_variable* get(const char_t* name) const;
    @@ -5688,7 +5672,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in diff --git a/docs/quickstart.html b/docs/quickstart.html index 382fca0..5552895 100644 --- a/docs/quickstart.html +++ b/docs/quickstart.html @@ -4,7 +4,7 @@ - + pugixml 1.8 quick start guide @@ -90,13 +90,12 @@ strong,b{font-weight:bold;line-height:inherit} small{font-size:60%;line-height:inherit} code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)} ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit} -ul,ol,ul.no-bullet,ol.no-bullet{margin-left:1.5em} +ul,ol{margin-left:1.5em} ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em} ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit} ul.square{list-style-type:square} ul.circle{list-style-type:circle} ul.disc{list-style-type:disc} -ul.no-bullet{list-style:none} ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0} dl dt{margin-bottom:.3125em;font-weight:bold} dl dd{margin-bottom:1.25em} @@ -132,7 +131,11 @@ strong strong{font-weight:400} kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap} .keyseq kbd:first-child{margin-left:0} .keyseq kbd:last-child{margin-right:0} -.menuseq,.menu{color:rgba(0,0,0,.8)} +.menuseq,.menuref{color:#000} +.menuseq b:not(.caret),.menuref{font-weight:inherit} +.menuseq{word-spacing:-.02em} +.menuseq b.caret{font-size:1.25em;line-height:.8} +.menuseq i.caret{font-weight:bold;text-align:center;width:.45em} b.button:before,b.button:after{position:relative;top:-1px;font-weight:400} b.button:before{content:"[";padding:0 3px 0 2px} b.button:after{content:"]";padding:0 2px 0 3px} @@ -199,7 +202,7 @@ table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0} table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit} .admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%} .admonitionblock>table td.icon{text-align:center;width:80px} -.admonitionblock>table td.icon img{max-width:none} +.admonitionblock>table td.icon img{max-width:initial} .admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase} .admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)} .admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0} @@ -255,13 +258,13 @@ table.pyhltable .linenodiv{background:none!important;padding-right:0!important} table.tableblock{max-width:100%;border-collapse:separate} table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0} table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede} -table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0} -table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0} -table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0} -table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0} -table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0} -table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0} -table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0} +table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0} +table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0} +table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0} +table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px 0} +table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0 0} +table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0} +table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0} table.frame-all{border-width:1px} table.frame-sides{border-width:0 1px} table.frame-topbot{border-width:1px 0} @@ -282,10 +285,12 @@ ul li ol{margin-left:1.5em} dl dd{margin-left:1.125em} dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0} ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em} -ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none} -ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em} -ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:.85em} -ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px} +ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none} +ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em} +ul.unstyled,ol.unstyled{margin-left:0} +ul.checklist{margin-left:.625em} +ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em} +ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em} ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden} ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block} ul.inline>li>*{display:block} @@ -302,7 +307,8 @@ ol.lowergreek{list-style-type:lower-greek} td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em} td.hdlist1{font-weight:bold;padding-bottom:1.25em} .literalblock+.colist,.listingblock+.colist{margin-top:-.5em} -.colist>table tr>td:first-of-type{padding:0 .75em;line-height:1} +.colist>table tr>td:first-of-type{padding:.4em .75em 0 .75em;line-height:1;vertical-align:top} +.colist>table tr>td:first-of-type img{max-width:initial} .colist>table tr>td:last-of-type{padding:.25em 0} .thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd} .imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0} @@ -365,6 +371,7 @@ div.unbreakable{page-break-inside:avoid} .yellow{color:#bfbf00} .yellow-background{background-color:#fafa00} span.icon>.fa{cursor:default} +a span.icon>.fa{cursor:inherit} .admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default} .admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c} .admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111} @@ -425,8 +432,10 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b .listingblock .pygments .tok-err { border: 1px solid #FF0000 } /* Error */ .listingblock .pygments .tok-k { color: #008000; font-weight: bold } /* Keyword */ .listingblock .pygments .tok-o { color: #666666 } /* Operator */ +.listingblock .pygments .tok-ch { color: #408080; font-style: italic } /* Comment.Hashbang */ .listingblock .pygments .tok-cm { color: #408080; font-style: italic } /* Comment.Multiline */ .listingblock .pygments .tok-cp { color: #BC7A00 } /* Comment.Preproc */ +.listingblock .pygments .tok-cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */ .listingblock .pygments .tok-c1 { color: #408080; font-style: italic } /* Comment.Single */ .listingblock .pygments .tok-cs { color: #408080; font-style: italic } /* Comment.Special */ .listingblock .pygments .tok-gd { color: #A00000 } /* Generic.Deleted */ @@ -1033,7 +1042,7 @@ XPath functions throw xpath_exception objects on error; the sample
    -
    Copyright (c) 2006-2016 Arseny Kapoulkine
    +
    Copyright (c) 2006-2017 Arseny Kapoulkine
     
     Permission is hereby granted, free of charge, to any person
     obtaining a copy of this software and associated documentation
    @@ -1063,7 +1072,7 @@ OTHER DEALINGS IN THE SOFTWARE.
    This software is based on pugixml library (http://pugixml.org).
    -pugixml is Copyright (C) 2006-2016 Arseny Kapoulkine.
    +pugixml is Copyright (C) 2006-2017 Arseny Kapoulkine.
    @@ -1077,7 +1086,7 @@ pugixml is Copyright (C) 2006-2016 Arseny Kapoulkine. -- cgit v1.2.3