53 #include <libxml/valid.h>
54 #include <libxml/parser.h>
62 extern "C" void cb_dtd_error (
void *v,
const char *message, ...);
63 extern "C" void cb_dtd_warning (
void *v,
const char *message, ...);
76 FILE *
test(fopen(filename,
"r"));
80 return std::string(
"unable to parse DTD ") + filename;
102 pimpl_->
dtd_ = xmlParseDTD(0,
reinterpret_cast<const xmlChar*
>(filename));
132 std::unique_ptr<error_messages> msgs;
138 memset(&vctxt, 0,
sizeof(vctxt));
139 vctxt.error = cb_dtd_error;
140 vctxt.warning = cb_dtd_warning;
141 vctxt.userData = temp;
174 if (
this != &other) {
197 return reinterpret_cast<const char*
>(
pimpl_->
dtd_->ExternalID);
201 return reinterpret_cast<const char*
>(
pimpl_->
dtd_->SystemID);
205 return reinterpret_cast<const char*
>(
pimpl_->
dtd_->name);
215 long line = xmlLastError.line;
219 if (xmlLastError.file !=
NULL)
220 filename = xmlLastError.file;
227 extern "C" void cb_dtd_error (
void *v,
const char *message, ...) {
231 va_start(ap, message);
238 extern "C" void cb_dtd_warning (
void *v,
const char *message, ...) {
242 va_start(ap, message);
The xml::document class is used to hold the XML tree and various bits of information about it.
The xml::dtd class represents an XML dtd from a file.
virtual ~dtd()
Destroy the object.
bool validate(const document &doc, error_messages *messages, warnings_as_errors_type how=type_warnings_are_errors) const
Validate the given XML document.
const char * get_public_id(void) const
Get the public ID.
void * get_raw_pointer(void) const
dtd & operator=(dtd &&other)
Moving assignment.
const char * get_system_id(void) const
Get the system ID.
void set_dtd_data(void *data)
const char * get_name(void) const
Get the name.
The xml::error_message class is used to store a single error message which may appear while parsing o...
message_type
A type for different type of errors.
The xml::error_messages class is used to store all the error message which are collected while parsin...
const error_messages_type & get_messages(void) const
Get the error messages.
bool has_warnings(void) const
Check if there are warnings in the error messages.
bool has_errors(void) const
Check if there are errors in the error messages.
This exception class is thrown by xmlwrapp for all runtime XML-related errors along with the xml::par...
The xml::parser_exception class is used to store parsing and validating exception information.
static std::string get_dtd_parsing_error_message(const char *filename)
XML dtd API for XmlWrapp.
This file contains the definition of the xml::document class.
This file contains the definition of the xml::exception class.
void clear_https_messages(void)
void printf2string(std::string &s, const char *message, va_list ap)
void collect_https_messages(xml::error_messages &append_to)
warnings_as_errors_type
A type for different approaches to process warnings.
@ type_warnings_are_errors
Treat warnings as errors.
int test(int srctype, const void *srcdata, int srclen, int dsttype, int dstlen)