fw4spl
fwRuntime::io::Validator Struct Reference

Implements an XML validator. More...

#include <Validator.hpp>

Public Member Functions

FWRUNTIME_API Validator (const Validator &validator)
 Copy Constructor. More...
 
FWRUNTIME_API Validator (const std::string &schema)
 Constructor. More...
 
FWRUNTIME_API Validator (const boost::filesystem::path &path)
 Constructor. More...
 
FWRUNTIME_API ~Validator ()
 Destructor.
 
void clearErrorLog ()
 Clears the error log.
 
FWRUNTIME_API const std::string getErrorLog () const
 Retrieves the error log content. More...
 
FWRUNTIME_API bool validate (const boost::filesystem::path &xmlFile)
 Validates the given file. More...
 
FWRUNTIME_API bool validate (xmlNodePtr node)
 Validates the given xml node. More...
 
FWRUNTIME_API std::string getXsdContent ()
 Returns the xsd content in string format. More...
 

Detailed Description

Implements an XML validator.

Warning
Potential Bug : class Validator can generate bug (infinite loop) when used with other Validator class instance. It seems that this class use a static ivar to save schemaValidationContext. If your call a instance of an visitor this ivar should not be directly well positionned. So the recommandation is to construct Validator-Use it-destry it and never store him
Date
2007-2009

Definition at line 37 of file Validator.hpp.

Constructor & Destructor Documentation

fwRuntime::io::Validator::Validator ( const Validator validator)

Copy Constructor.

Copy a validator.

Parameters
validatorto be copied

Definition at line 31 of file Validator.cpp.

fwRuntime::io::Validator::Validator ( const std::string &  schema)

Constructor.

Builds a validator with a string containing a XML shema.

Parameters
schemaa string containing the XML schema

Definition at line 40 of file Validator.cpp.

fwRuntime::io::Validator::Validator ( const boost::filesystem::path &  path)

Constructor.

Builds a validator with a path to a file containing an XML schema.

Parameters
patha path to the xml schema file to load

Definition at line 47 of file Validator.cpp.

Member Function Documentation

const std::string fwRuntime::io::Validator::getErrorLog ( ) const

Retrieves the error log content.

Returns
a string containing the error log

Definition at line 73 of file Validator.cpp.

Referenced by fwRuntime::io::BundleDescriptorReader::createBundle(), fwRuntime::io::ProfileReader::createProfile(), and validate().

+ Here is the caller graph for this function:

std::string fwRuntime::io::Validator::getXsdContent ( )

Returns the xsd content in string format.

Returns
xsd of the validator

Definition at line 196 of file Validator.cpp.

Referenced by validate().

+ Here is the caller graph for this function:

bool fwRuntime::io::Validator::validate ( const boost::filesystem::path &  xmlFile)

Validates the given file.

Parameters
xmlFilea path to an xml file to validate
Returns
true when the validation succeeds, false otherwise

Definition at line 120 of file Validator.cpp.

References getErrorLog(), getXsdContent(), OSLM_ERROR, and OSLM_WARN.

Referenced by fwRuntime::io::BundleDescriptorReader::createBundle(), and fwRuntime::io::ProfileReader::createProfile().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fwRuntime::io::Validator::validate ( xmlNodePtr  node)

Validates the given xml node.

Parameters
nodea pointer to an xml node
Returns
true when the validation succeeds, false otherwise

Definition at line 159 of file Validator.cpp.

References getErrorLog(), getXsdContent(), OSLM_ERROR, and OSLM_WARN.

+ Here is the call graph for this function:


The documentation for this struct was generated from the following files: