From 186e491d1e7f7bddc04d5169084b224a648aa457 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 31 Oct 2010 07:45:27 +0000 Subject: docs: Regenerated HTML documentation git-svn-id: http://pugixml.googlecode.com/svn/trunk@790 99668b35-9821-0410-8761-19e4c4f06640 --- docs/manual/saving.html | 111 ++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 60 deletions(-) (limited to 'docs/manual/saving.html') diff --git a/docs/manual/saving.html b/docs/manual/saving.html index e12b31d..2cbf06e 100644 --- a/docs/manual/saving.html +++ b/docs/manual/saving.html @@ -4,14 +4,15 @@ Saving document - - + + -
pugixml 0.9 manual | + +pugixml 1.0 manual | Overview | Installation | Document: @@ -49,42 +50,45 @@ the relevant functionality.

- The node/attribute data is written to the destination properly formatted according - to the node type; all special XML symbols, such as < and &, are properly - escaped. In order to guard against forgotten node/attribute names, empty node/attribute - names are printed as ":anonymous". - For proper output, make sure all node and attribute names are set to meaningful + Before writing to the destination the node/attribute data is properly formatted + according to the node type; all special XML symbols, such as < and &, + are properly escaped. In order to guard against forgotten node/attribute names, + empty node/attribute names are printed as ":anonymous". + For well-formed output, make sure all node and attribute names are set to meaningful values.

-
- - - - - -
[Caution]Caution

- Currently the content of CDATA sections is not escaped, so CDATA sections - with values that contain "]]>" - will result in malformed document. This will be fixed in version 1.0. -

+

+ 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. +

-

- If you want to save the whole document to a file, you can use the following - function: +

+ If you want to save the whole document to a file, you can use one of the + following functions:

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;
 

- This function accepts file path as its first argument, and also three optional + These functions accept 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. + have the delimiters of the target system, it should have the exact case if + the target file system is case-sensitive, etc. +

+

+ File path is passed to the 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.

save_file opens the target @@ -96,19 +100,6 @@ handle as the only constructor argument and then calling save; see Saving document via writer interface for writer interface details.

-
- - - - - -
[Note]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):

@@ -126,11 +117,11 @@ Saving document to C++ IOstreams

- For additional interoperability pugixml provides functions for saving document - to any object which implements C++ std::ostream interface. This allows you - to save documents to any standard C++ stream (i.e. file stream) or any third-party - compliant implementation (i.e. Boost Iostreams). Most notably, this allows - for easy debug output, since you can use std::cout + To enhance interoperability pugixml provides functions for saving document + to any object which implements C++ std::ostream + interface. This allows you to save documents to any standard C++ stream (i.e. + file stream) or any third-party compliant implementation (i.e. Boost Iostreams). + Most notably, this allows for easy debug output, since you can use std::cout stream as saving target. There are two functions, one works with narrow character streams, another handles wide character ones:

@@ -142,7 +133,7 @@ argument saves the document to the stream in the same way as save_file (i.e. with requested header and with encoding conversions). On the other hand, save with std::wstream argument saves the document to - the wide stream with encoding_wchar + the wide stream with encoding_wchar encoding. Because of this, using save with wide character streams requires careful (usually platform-specific) stream setup (i.e. using the imbue @@ -201,7 +192,7 @@

write function is called with relatively large blocks (size is usually several kilobytes, except for - the first block with BOM, which is output only if format_write_bom + the first block with BOM, which is output only if format_write_bom is set, and last block, which may be small), so there is often no need for additional buffering in the implementation.

@@ -231,9 +222,8 @@ Saving a single subtree

- While the previously described functions saved the whole document to the - destination, it is easy to save a single subtree. The following functions - are provided: + While the previously described functions save the whole document to the destination, + it is easy to save a single subtree. The following functions are provided:

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;
@@ -246,10 +236,10 @@
       

Saving a subtree differs from saving the whole document: the process behaves - as if format_write_bom is - off, and format_no_declaration - is on, even if actual values of the flags are different. This means that - BOM is not written to the destination, and document declaration is only written + as if format_write_bom is off, and + format_no_declaration is on, + even if actual values of the flags are different. This means that BOM is + not written to the destination, and document declaration is only written if it is the node itself or is one of node's children. Note that this also holds if you're saving a document; this example (samples/save_subtree.cpp) illustrates the difference: @@ -308,8 +298,8 @@ by default). If this flag is on, before every node the indentation string is output several times, where the amount of indentation depends on the node's depth relative to the output subtree. This flag has no effect - if format_raw is enabled. - This flag is on by default.

+ if format_raw is enabled. This flag + is on by default.

  • @@ -318,9 +308,9 @@ and also no newlines that are not part of document text are printed. Raw mode can be used for serialization where the result is not intended to be read by humans; also it can be useful if the document was parsed - with parse_ws_pcdata - flag, to preserve the original document formatting as much as possible. - This flag is off by default. + with parse_ws_pcdata flag, to + preserve the original document formatting as much as possible. This flag + is off by default.
  • @@ -429,7 +419,7 @@

    Also note that wide stream saving functions do not have encoding - argument and always assume encoding_wchar + argument and always assume encoding_wchar encoding.

    @@ -456,7 +446,8 @@

    -
    pugixml 0.9 manual | + +pugixml 1.0 manual | Overview | Installation | Document: -- cgit v1.2.3