#include <tree_parser.h>
Public Member Functions | |
tree_parser (const char *filename, bool allow_exceptions=true) | |
xml::tree_parser class constructor. | |
tree_parser (const char *data, size_type size, bool allow_exceptions=true) | |
xml::tree_parser class constructor. | |
~tree_parser (void) | |
xml::tree_parser class destructor. | |
bool | operator! (void) const |
Check to see if a xml::tree_parser class is vaild. | |
const std::string & | get_error_message (void) const |
If operator! indicates that there was an error parsing your XML data, you can use this member function to get the error message that was generated durring parsing. | |
bool | had_warnings (void) const |
Check to see if there were any warnings from the parser while processing the given XML data. | |
xml::document & | get_document (void) |
Get a reference to the xml::document that was generated during the XML parsing. | |
const xml::document & | get_document (void) const |
Get a const reference to the xml::document that was generate during the XML parsing. |
After constructing a tree_parser, with either a file to parse or some in memory data to parse, you can walk the tree using the xml::node interface.
|
xml::tree_parser class constructor. Given the name of a file, this constructor will parse that file. There are two options for dealing with XML parsing errors. The default it to throw an exception (std::runtime_error). The other option is to pass false for the allow_exceptions flag. This will prevent an exception from being thrown, instead, a flag will be set that you can test with the operator! member function. No matter what option you choose, this constructor may still throw exceptions for memory failure or other non-parsing related failures.
|
|
xml::tree_parser class constructor. Given some data and the size of that data, parse that data as XML. To see if the data was parsed successfully use operator!.
|
|
xml::tree_parser class destructor.
|
|
Get a const reference to the xml::document that was generate during the XML parsing. You should make sure to only use a reference to the document to avoid a deep copy.
|
|
Get a reference to the xml::document that was generated during the XML parsing. You should make sure to only use a reference to the document to avoid a deep copy.
|
|
If operator! indicates that there was an error parsing your XML data, you can use this member function to get the error message that was generated durring parsing.
|
|
Check to see if there were any warnings from the parser while processing the given XML data. If there were, you may want to send the same document through xmllint or the event_parser to catch and review the warning messages.
|
|
Check to see if a xml::tree_parser class is vaild. That is, check to see if parsing XML data was successful and the tree_parser holds a good XML node tree.
|