pugi::xml_document Class Reference

Inheritance diagram for pugi::xml_document:

Inheritance graph
[legend]
Collaboration diagram for pugi::xml_document:

Collaboration graph
[legend]
List of all members.

Detailed Description

Document class (DOM tree root).

This class has noncopyable semantics (private copy ctor/assignment operator).


Public Member Functions

 xml_document ()
 Default ctor, makes empty document.
 ~xml_document ()
 Dtor.
xml_parse_result load (std::basic_istream< char, std::char_traits< char > > &stream, unsigned int options=parse_default, encoding_t encoding=encoding_auto)
 Load document from stream.
xml_parse_result load (std::basic_istream< wchar_t, std::char_traits< wchar_t > > &stream, unsigned int options=parse_default)
 Load document from stream.
xml_parse_result load (const char_t *contents, unsigned int options=parse_default)
 Load document from string.
PUGIXML_DEPRECATED xml_parse_result parse (char *xmlstr, unsigned int options=parse_default)
 Parse the given XML string in-situ.
PUGIXML_DEPRECATED xml_parse_result parse (const transfer_ownership_tag &, char *xmlstr, unsigned int options=parse_default)
 Parse the given XML string in-situ (gains ownership).
xml_parse_result load_file (const char *name, unsigned int options=parse_default, encoding_t encoding=encoding_auto)
 Load document from file.
xml_parse_result load_buffer (const void *contents, size_t size, unsigned int options=parse_default, encoding_t encoding=encoding_auto)
 Load document from buffer.
xml_parse_result load_buffer_inplace (void *contents, size_t size, unsigned int options=parse_default, encoding_t encoding=encoding_auto)
 Load document from buffer in-situ.
xml_parse_result load_buffer_inplace_own (void *contents, size_t size, unsigned int options=parse_default, encoding_t encoding=encoding_auto)
 Load document from buffer in-situ (gains buffer ownership).
void save (xml_writer &writer, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, encoding_t encoding=encoding_auto) const
 Save XML to writer.
void save (std::basic_ostream< char, std::char_traits< char > > &stream, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, encoding_t encoding=encoding_auto) const
 Save XML to stream.
void save (std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &stream, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default) const
 Save XML to stream.
bool save_file (const char *name, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, encoding_t encoding=encoding_auto) const
 Save XML to file.
PUGIXML_DEPRECATED void precompute_document_order ()
 Compute document order for the whole tree Sometimes this makes evaluation of XPath queries faster.


Member Function Documentation

xml_parse_result pugi::xml_document::load std::basic_istream< char, std::char_traits< char > > &  stream,
unsigned int  options = parse_default,
encoding_t  encoding = encoding_auto
 

Load document from stream.

Parameters:
stream - stream with xml data
options - parsing options
encoding - source data encoding
Returns:
parsing result

xml_parse_result pugi::xml_document::load std::basic_istream< wchar_t, std::char_traits< wchar_t > > &  stream,
unsigned int  options = parse_default
 

Load document from stream.

Parameters:
stream - stream with xml data
options - parsing options
Returns:
parsing result

xml_parse_result pugi::xml_document::load const char_t contents,
unsigned int  options = parse_default
 

Load document from string.

String has to be zero-terminated. No encoding conversions are applied.

Parameters:
contents - input string
options - parsing options
Returns:
parsing result

PUGIXML_DEPRECATED xml_parse_result pugi::xml_document::parse char *  xmlstr,
unsigned int  options = parse_default
 

Parse the given XML string in-situ.

The string is modified; you should ensure that string data will persist throughout the document's lifetime. Although, document does not gain ownership over the string, so you should free the memory occupied by it manually.

Parameters:
xmlstr - readwrite string with xml data
options - parsing options
Returns:
parsing result
Deprecated:
This function is deprecated and will be removed in future versions; use xml_document::load_buffer_inplace instead

PUGIXML_DEPRECATED xml_parse_result pugi::xml_document::parse const transfer_ownership_tag ,
char *  xmlstr,
unsigned int  options = parse_default
 

Parse the given XML string in-situ (gains ownership).

The string is modified; document gains ownership over the string, so you don't have to worry about it's lifetime. Call example: doc.parse(transfer_ownership_tag(), string, options);

Parameters:
xmlstr - readwrite string with xml data
options - parsing options
Returns:
parsing result
Deprecated:
This function is deprecated and will be removed in future versions; use xml_document::load_buffer_inplace_own instead

xml_parse_result pugi::xml_document::load_file const char *  name,
unsigned int  options = parse_default,
encoding_t  encoding = encoding_auto
 

Load document from file.

Parameters:
name - file name
options - parsing options
encoding - source data encoding
Returns:
parsing result

xml_parse_result pugi::xml_document::load_buffer const void *  contents,
size_t  size,
unsigned int  options = parse_default,
encoding_t  encoding = encoding_auto
 

Load document from buffer.

Parameters:
contents - buffer contents
size - buffer size in bytes
options - parsing options
encoding - source data encoding
Returns:
parsing result

xml_parse_result pugi::xml_document::load_buffer_inplace void *  contents,
size_t  size,
unsigned int  options = parse_default,
encoding_t  encoding = encoding_auto
 

Load document from buffer in-situ.

The buffer is modified; you should ensure that buffer data will persist throughout the document's lifetime. Document does not gain ownership over the buffer, so you should free the buffer memory manually.

Parameters:
contents - buffer contents
size - buffer size in bytes
options - parsing options
encoding - source data encoding
Returns:
parsing result

xml_parse_result pugi::xml_document::load_buffer_inplace_own void *  contents,
size_t  size,
unsigned int  options = parse_default,
encoding_t  encoding = encoding_auto
 

Load document from buffer in-situ (gains buffer ownership).

The buffer is modified; you should ensure that buffer data will persist throughout the document's lifetime. Document gains ownership over the buffer, so you should allocate the buffer with pugixml allocation function.

Parameters:
contents - buffer contents
size - buffer size in bytes
options - parsing options
encoding - source data encoding
Returns:
parsing result

void pugi::xml_document::save xml_writer writer,
const char_t indent = PUGIXML_TEXT("\t"),
unsigned int  flags = format_default,
encoding_t  encoding = encoding_auto
const
 

Save XML to writer.

Parameters:
writer - writer object
indent - indentation string
flags - formatting flags
encoding - encoding used for writing

void pugi::xml_document::save std::basic_ostream< char, std::char_traits< char > > &  stream,
const char_t indent = PUGIXML_TEXT("\t"),
unsigned int  flags = format_default,
encoding_t  encoding = encoding_auto
const
 

Save XML to stream.

Parameters:
stream - output stream
indent - indentation string
flags - formatting flags
encoding - encoding used for writing

void pugi::xml_document::save std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &  stream,
const char_t indent = PUGIXML_TEXT("\t"),
unsigned int  flags = format_default
const
 

Save XML to stream.

Parameters:
stream - output stream
indent - indentation string
flags - formatting flags

bool pugi::xml_document::save_file const char *  name,
const char_t indent = PUGIXML_TEXT("\t"),
unsigned int  flags = format_default,
encoding_t  encoding = encoding_auto
const
 

Save XML to file.

Parameters:
name - file name
indent - indentation string
flags - formatting flags
encoding - encoding used for writing
Returns:
success flag


Generated on Tue May 25 23:22:41 2010 for pugixml by  doxygen 1.4.6-NO