Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Attributes | List of all members
XMLValidator Class Reference

Validator for XML files. More...

#include <OpenMS/FORMAT/VALIDATORS/XMLValidator.h>

Inheritance diagram for XMLValidator:

Public Member Functions

 XMLValidator ()
 Constructor. More...
 
bool isValid (const String &filename, const String &schema, std::ostream &os=std::cerr)
 Returns if an XML file is valid for given a schema file. More...
 

Protected Member Functions

Implementation of Xerces ErrorHandler methods
virtual void warning (const xercesc::SAXParseException &exception)
 
virtual void error (const xercesc::SAXParseException &exception)
 
virtual void fatalError (const xercesc::SAXParseException &exception)
 
virtual void resetErrors ()
 

Protected Attributes

bool valid_
 Flag if the validated file is valid. More...
 
String filename_
 File name of validated file (for error messages) More...
 
std::ostream * os_
 

Detailed Description

Validator for XML files.

Validates an XML file against a given schema.

Constructor & Destructor Documentation

Constructor.

Member Function Documentation

virtual void error ( const xercesc::SAXParseException &  exception)
protectedvirtual
virtual void fatalError ( const xercesc::SAXParseException &  exception)
protectedvirtual
bool isValid ( const String filename,
const String schema,
std::ostream &  os = std::cerr 
)

Returns if an XML file is valid for given a schema file.

Error messages are printed to the error stream, unless redirected with the attribute os .

Parameters
filenameThe file to validated.
schemaThe filename of the schema that should be used for validation.
osThe stream where error messages should be send to.
Exceptions
Exception::FileNotFoundis thrown if the file cannot be found
Exception::ParseErroris thrown if the parser could not be initialized
virtual void resetErrors ( )
protectedvirtual
virtual void warning ( const xercesc::SAXParseException &  exception)
protectedvirtual

Member Data Documentation

String filename_
protected

File name of validated file (for error messages)

std::ostream* os_
protected
bool valid_
protected

Flag if the validated file is valid.


OpenMS / TOPP release 2.0.0 Documentation generated on Thu Aug 20 2015 01:44:42 using doxygen 1.8.9.1