From 2894cc4eb253859479a13b709faab1e95b7a924c Mon Sep 17 00:00:00 2001
From: "arseny.kapoulkine"
This function returns the node with type
While pugixml supports complex XPath expressions, sometimes a simple path
diff --git a/docs/manual/apiref.html b/docs/manual/apiref.html
index 5e595cf..24120ad 100644
--- a/docs/manual/apiref.html
+++ b/docs/manual/apiref.html
@@ -800,15 +800,7 @@
= parse_default, xml_encoding
encoding =
encoding_auto);
-
-
Functions:
- $$ overloads, types * as_utf8 * as_wide
- * get_memory_allocation_function
- * get_memory_deallocation_function
- * set_memory_management_functions
-
- $$ wording - one may think that child() has a string overload All tree functions
- that work with strings work with either C-style null terminated strings or
- STL strings of the selected character type. For example, node name accessors
- look like this in char mode:
+ All tree functions that work with strings work with either C-style null terminated
+ strings or STL strings of the selected character type. For example, node
+ name accessors look like this in char mode:
node_document
,
which is the root node of the document the node belongs to (unless the node
- is null, in which case null node is returned).
+ is null, in which case null node is returned). Currently this function has
+ logarithmic complexity, since it simply finds such ancestor of the given
+ node which itself has no parent.
xml_parse_result
load_file(const wchar_t*
- path,
- unsigned int
- options =
- parse_default,
- xml_encoding encoding
- = encoding_auto);
+
bool
save_file(const wchar_t*
- path,
- const char_t* indent
- = "\t", unsigned
- int flags
- = format_default, xml_encoding
- encoding =
- encoding_auto)
- const;
xml_encoding
encoding;
-();
- operator
bool() const;
+
diff --git a/docs/manual/dom.html b/docs/manual/dom.html
index def86a5..2d65070 100644
--- a/docs/manual/dom.html
+++ b/docs/manual/dom.html
@@ -371,10 +371,9 @@
const char* xml_node::name() const;
bool xml_node::set_name(const char* value);
@@ -417,12 +416,7 @@
performs conversion from UTF-8 to UTF-16/32. Invalid UTF sequences are silently
discarded upon conversion.
str
has to be a valid string; passing null pointer results in undefined behavior.
- There are also two overloads with the same semantics which accept a string
- as an argument:
std::string as_utf8(const std::wstring& str); -std::wstring as_wide(const std::string& str); -
@@ -499,7 +493,7 @@ guarantees beyond the ones provided by callback. |
+ | Note | +
---|---|
+ Currently memory for XPath objects is allocated using default operators + new/delete; this will change in the next version. + |
- The most common source of XML data is files; pugixml provides dedicated functions - for loading XML document from file: +
+ The most common source of XML data is files; pugixml provides a separate + function for loading XML document from file:
xml_parse_result xml_document::load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto); -xml_parse_result xml_document::load_file(const wchar_t* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
- These functions accept file path as its first argument, and also two optional + This function accepts file path as its first argument, and also two optional arguments, which specify parsing options (see Parsing options) and input data encoding (see Encodings). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of target system, it should have the exact case if target - file system is case-sensitive, etc. -
-
- File path is passed to system file opening function as is in case of the
- first function (which accepts const
- char* path
); the second function either uses
- a special file opening function if it is provided by the runtime library
- or converts the path to UTF-8 and uses the system file opening function.
+ file system is case-sensitive, etc. File path is passed to system file opening
+ function as is.
load_file
destroys the existing
@@ -95,6 +88,20 @@
(i.e. last successfully parsed position in the input file, if parsing fails).
See Handling parsing errors for error handling details.
+ | Note | +
---|---|
+ As of version 0.9, there is no function for loading XML document from wide
+ character path. Unfortunately, there is no portable way to do this; the
+ version 1.0 will provide such function only for platforms with the corresponding
+ functionality. You can use stream-loading functions as a workaround if
+ your STL implementation can open file streams via |
This is an example of loading XML document from file (samples/load_file.cpp):
@@ -290,7 +297,7 @@ -
All document loading functions return the parsing result via xml_parse_result
object. It contains parsing
status, the offset of last successfully parsed character from the beginning
of the source stream, and the encoding of the source stream:
@@ -301,7 +308,6 @@
ptrdiff_t offset;
xml_encoding encoding;
- xml_parse_result();
operator bool() const;
const char* description() const;
};
diff --git a/docs/manual/saving.html b/docs/manual/saving.html
index 584cb2c..e12b31d 100644
--- a/docs/manual/saving.html
+++ b/docs/manual/saving.html
@@ -56,38 +56,35 @@
For proper output, make sure all node and attribute names are set to meaningful
values.
- CDATA sections with values that contain "]]>"
- are split into several sections as follows: section with value "pre]]>post"
is written as <![CDATA[pre]]]]><![CDATA[>post]]>
.
- While this alters the structure of the document (if you load the document after
- saving it, there will be two CDATA sections instead of one), this is the only
- way to escape CDATA contents.
-
+ | Caution | +
---|---|
+ Currently the content of CDATA sections is not escaped, so CDATA sections
+ with values that contain |
- If you want to save the whole document to a file, you can use one of the - following functions: +
+ If you want to save the whole document to a file, you can use the following + function:
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;
- These functions accept file path as its first argument, and also three optional + This function accepts file path as its first argument, and also three optional arguments, which specify indentation and other output options (see Output options) and output data encoding (see Encodings). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of target system, it should have the exact case if target - file system is case-sensitive, etc. -
-
- File path is passed to system file opening function as is in case of the
- first function (which accepts const
- char* path
); the second function either uses
- a special file opening function if it is provided by the runtime library
- or converts the path to UTF-8 and uses the system file opening function.
+ file system is case-sensitive, etc. File path is passed to system file opening
+ function as is.
save_file
opens the target
@@ -99,6 +96,19 @@
handle as the only constructor argument and then calling save
;
see Saving document via writer interface for writer interface details.
+ | Note | +
---|---|
+ As of version 0.9, there is no function for saving XML document to wide + character paths. Unfortunately, there is no portable way to do this; the + version 1.0 will provide such function only for platforms with the corresponding + functionality. You can use stream-saving functions as a workaround if your + STL implementation can open file streams via wchar_t paths. + |
This is a simple example of saving XML document to file (samples/save_file.cpp):
diff --git a/docs/manual/xpath.html b/docs/manual/xpath.html index 513bb90..731a969 100644 --- a/docs/manual/xpath.html +++ b/docs/manual/xpath.html @@ -54,9 +54,6 @@ at tizag.com, and the XPath 1.0 specification. -- $$ -
@@ -123,11 +120,9 @@ You can also create XPath nodes with one of tree constructors: the default constructor, the constructor that takes node argument, and the constructor that takes attribute and node arguments (in which case the attribute must - belong to the attribute list of the node). The constructor from |