libxml++
2.40.1
|
DOM XML parser. More...
#include <libxml++/parsers/domparser.h>
Public Member Functions | |
DomParser () | |
Create a parser with an empty document. More... | |
DomParser (const Glib::ustring& filename, bool validate=false) | |
Instantiate the parser and parse a document immediately. More... | |
~DomParser () override | |
Document* | get_document () |
Get the parsed document. More... | |
const Document* | get_document () const |
Get the parsed document. More... | |
operator bool () const | |
Test whether a document has been parsed. More... | |
void | parse_file (const Glib::ustring& filename) override |
Parse an XML document from a file. More... | |
void | parse_memory (const Glib::ustring& contents) override |
Parse an XML document from a string. More... | |
void | parse_memory_raw (const unsigned char* contents, size_type bytes_count) |
Parse an XML document from raw memory. More... | |
void | parse_stream (std::istream& in) override |
Parse an XML document from a stream. More... | |
![]() | |
Parser () | |
~Parser () override | |
bool | get_include_default_attributes () |
See set_include_default_attributes(). More... | |
void | get_parser_options (int& set_options, int& clear_options) |
See set_parser_options(). More... | |
virtual bool | get_substitute_entities () const |
See set_substitute_entities(). More... | |
bool | get_throw_messages () const |
See set_throw_messages(). More... | |
virtual bool | get_validate () const |
See set_validate(). More... | |
void | set_include_default_attributes (bool val=true) |
Set whether default attribute values from the DTD shall be included in the node tree. More... | |
void | set_parser_options (int set_options=0, int clear_options=0) |
Set and/or clear parser option flags. More... | |
virtual void | set_substitute_entities (bool val=true) |
Set whether the parser will automatically substitute entity references with the text of the entities' definitions. More... | |
void | set_throw_messages (bool val=true) |
Set whether the parser will collect and throw error and warning messages. More... | |
virtual void | set_validate (bool val=true) |
By default, the parser will not validate the XML file. More... | |
Protected Member Functions | |
virtual void | parse_context () |
void | release_underlying () override |
![]() | |
virtual void | check_for_exception () |
virtual void | check_for_validity_messages () |
virtual void | handleException (const exception& e) |
virtual void | initialize_context () |
virtual void | on_validity_error (const Glib::ustring& message) |
virtual void | on_validity_warning (const Glib::ustring& message) |
Protected Attributes | |
Document* | doc_ |
![]() | |
_xmlParserCtxt* | context_ |
exception* | exception_ |
bool | substitute_entities_ |
bool | validate_ |
Glib::ustring | validate_error_ |
Glib::ustring | validate_warning_ |
Additional Inherited Members | |
![]() | |
typedef unsigned int | size_type |
![]() | |
enum | MsgType { MsgParserError, MsgParserWarning, MsgValidityError, MsgValidityWarning } |
![]() | |
static void | callback_error_or_warning (MsgType msg_type, void* ctx, const char* msg, va_list var_args) |
static void | callback_parser_error (void* ctx, const char* msg,...) |
static void | callback_parser_warning (void* ctx, const char* msg,...) |
static void | callback_validity_error (void* ctx, const char* msg,...) |
static void | callback_validity_warning (void* ctx, const char* msg,...) |
DOM XML parser.
xmlpp::DomParser::DomParser | ( | ) |
Create a parser with an empty document.
xmlpp::internal_error | If an empty document can't be created. |
|
explicit |
Instantiate the parser and parse a document immediately.
filename | The path to the file. |
validate | Whether the parser should validate the XML. |
|
override |
Document* xmlpp::DomParser::get_document | ( | ) |
Get the parsed document.
nullptr
. const Document* xmlpp::DomParser::get_document | ( | ) | const |
Get the parsed document.
nullptr
. xmlpp::DomParser::operator bool | ( | ) | const |
Test whether a document has been parsed.
|
protectedvirtual |
|
overridevirtual |
Parse an XML document from a file.
If the parser already contains a document, that document and all its nodes are deleted.
filename | The path to the file. |
Implements xmlpp::Parser.
|
overridevirtual |
Parse an XML document from a string.
If the parser already contains a document, that document and all its nodes are deleted.
contents | The XML document as a string. |
Implements xmlpp::Parser.
void xmlpp::DomParser::parse_memory_raw | ( | const unsigned char * | contents, |
size_type | bytes_count | ||
) |
Parse an XML document from raw memory.
If the parser already contains a document, that document and all its nodes are deleted.
contents | The XML document as an array of bytes. |
bytes_count | The number of bytes in the contents array. |
|
overridevirtual |
Parse an XML document from a stream.
If the parser already contains a document, that document and all its nodes are deleted.
in | The stream. |
Implements xmlpp::Parser.
|
overrideprotectedvirtual |
Reimplemented from xmlpp::Parser.
|
protected |