Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

XMLHandler Class Reference

#include <OpenMS/FORMAT/HANDLERS/XMLHandler.h>

Inheritance diagram for XMLHandler:

xercesc::DefaultHandler IdXMLFile ConsensusXMLHandler FeaturePairsHandler FeatureXMLHandler GridHandler MascotXMLHandler MzDataExpSettHandler MzDataHandler MzXMLHandler OMSSAXMLHandler ParamXMLHandler PTMXMLHandler

List of all members.


Detailed Description

Base class for XML handlers.

controlled vocabulary handling methods

std::vector< std::vector
< String > > 
cv_terms_
 Array of CV term lists (one sublist denotes one term and it's children).
UInt cvStringToEnum_ (UInt section, const String &term, const char *message)
 Converts term to the index of the term in the cv_terms_ entry section.

Public Member Functions

 XMLHandler (const String &filename, const String &version)
 Default constructor.
virtual ~XMLHandler ()
 Destructor.
void fatalError (const String &msg, UInt line=0, UInt column=0) const
 Fatal error handler. Throws a ParseError exception.
void error (const String &msg, UInt line=0, UInt column=0) const
 Error handler for recoverable errors.
void warning (const String &msg, UInt line=0, UInt column=0) const
 Warning handler.
virtual void characters (const XMLCh *const chars, unsigned int length)
 Parsing method for character data.
virtual void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const xercesc::Attributes &attrs)
 Parsing method for opening tags.
virtual void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
 Parsing method for closing tags.
virtual void writeTo (std::ostream &)
 Writes the contents to a stream.
String errorString ()
 Returns the last error description.
Reimplemented XERCES-C error handlers
These methods forward the error message to our own error handlers below.

void fatalError (const xercesc::SAXParseException &exception)
void error (const xercesc::SAXParseException &exception)
void warning (const xercesc::SAXParseException &exception)

Protected Member Functions

bool equal_ (const XMLCh *a, const XMLCh *b)
 Returns if two xerces strings are equal.
cvParam and userParam handling methods (for mzData and FeatureXML)
void writeCVS_ (std::ostream &os, DoubleReal value, const String &acc, const String &name, int indent=4) const
 write cvParam containing strings to stream
void writeCVS_ (std::ostream &os, const String &value, const String &acc, const String &name, int indent=4) const
 write cvParam containing strings to stream
void writeCVS_ (std::ostream &os, int value, int map, const String &acc, const String &name, int indent=4)
 write cvParam element to stream
void writeUserParam_ (std::ostream &os, const MetaInfoInterface &meta, int indent=4)
 Writing the MetaInfo as UserParam to the file.
General MetaInfo handling (for IdXML, FeatureXML, FeaturePairsXML)
void writeUserParam_ (const String &tag_name, std::ostream &os, const MetaInfoInterface &meta, UInt indent) const
 Writes the content of MetaInfoInterface to the file.
String conversion
Int asInt_ (const String &in)
 Conversion of a String to an integer value.
Int asInt_ (const XMLCh *in)
 Conversion of a Xerces string to an integer value.
UInt asUInt_ (const String &in)
 Conversion of a String to an unsigned integer value.
double asDouble_ (const String &in)
 Conversion of a String to a double value.
float asFloat_ (const String &in)
 Conversion of a String to a float value.
bool asBool_ (const String &in)
 Conversion of a String to a bool value.
DateTime asDateTime_ (const String &in)
 Conversion of a String to a DataTime value.
Accessing attributes
char * attributeAsString_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a String.
Int attributeAsInt_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a Int.
DoubleReal attributeAsDouble_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a DoubleReal.
void optionalAttributeAsString_ (String &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the String value if the attribute is present.
void optionalAttributeAsInt_ (Int &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the Int value if the attribute is present.
void optionalAttributeAsUInt_ (UInt &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the UInt value if the attribute is present.
void optionalAttributeAsDouble_ (DoubleReal &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the DoubleReal value if the attribute is present.
char * attributeAsString_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a String.
Int attributeAsInt_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a Int.
DoubleReal attributeAsDouble_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a DoubleReal.
void optionalAttributeAsString_ (String &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the String value if the attribute is present.
void optionalAttributeAsInt_ (Int &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the Int value if the attribute is present.
void optionalAttributeAsUInt_ (UInt &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the UInt value if the attribute is present.
void optionalAttributeAsDouble_ (DoubleReal &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the DoubleReal value if the attribute is present.

Protected Attributes

String error_message_
 Error message of the last error.
String file_
 File name.
String version_
 Schema version.
StringManager sm_
 Helper class for string conversion.
std::vector< Stringopen_tags_
 Stack of open XML tags.

Private Member Functions

 XMLHandler ()
 Not implemented.

Classes

class  EndParsingSoftly
 Exception that is thrown if the parsing is ended by some event (e.g. if only a prefix of the XML file is needed). More...

Constructor & Destructor Documentation

XMLHandler ( const String filename,
const String version 
)

Default constructor.

virtual ~XMLHandler (  )  [virtual]

Destructor.

XMLHandler (  )  [private]

Not implemented.


Member Function Documentation

void fatalError ( const xercesc::SAXParseException &  exception  ) 

void error ( const xercesc::SAXParseException &  exception  ) 

void warning ( const xercesc::SAXParseException &  exception  ) 

void fatalError ( const String msg,
UInt  line = 0,
UInt  column = 0 
) const

Fatal error handler. Throws a ParseError exception.

void error ( const String msg,
UInt  line = 0,
UInt  column = 0 
) const

Error handler for recoverable errors.

void warning ( const String msg,
UInt  line = 0,
UInt  column = 0 
) const

Warning handler.

virtual void characters ( const XMLCh *const   chars,
unsigned int  length 
) [virtual]

Parsing method for character data.

Reimplemented in ConsensusXMLHandler, FeaturePairsHandler, FeatureXMLHandler, GridHandler, MascotXMLHandler, MzDataExpSettHandler, MzDataHandler, MzXMLHandler, OMSSAXMLHandler, and PTMXMLHandler.

virtual void startElement ( const XMLCh *const   uri,
const XMLCh *const   localname,
const XMLCh *const   qname,
const xercesc::Attributes &  attrs 
) [virtual]

Parsing method for opening tags.

Reimplemented in ConsensusXMLHandler, FeaturePairsHandler, FeatureXMLHandler, GridHandler, MascotXMLHandler, MzDataExpSettHandler, MzDataHandler, MzXMLHandler, OMSSAXMLHandler, ParamXMLHandler, PTMXMLHandler, and IdXMLFile.

virtual void endElement ( const XMLCh *const   uri,
const XMLCh *const   localname,
const XMLCh *const   qname 
) [virtual]

Parsing method for closing tags.

Reimplemented in ConsensusXMLHandler, FeaturePairsHandler, FeatureXMLHandler, GridHandler, MascotXMLHandler, MzDataExpSettHandler, MzDataHandler, MzXMLHandler, OMSSAXMLHandler, ParamXMLHandler, PTMXMLHandler, and IdXMLFile.

virtual void writeTo ( std::ostream &   )  [inline, virtual]

Writes the contents to a stream.

Reimplemented in ConsensusXMLHandler, FeaturePairsHandler, FeatureXMLHandler, GridHandler, MzDataExpSettHandler, MzDataHandler, MzXMLHandler, and PTMXMLHandler.

String errorString (  ) 

Returns the last error description.

bool equal_ ( const XMLCh *  a,
const XMLCh *  b 
) [inline, protected]

Returns if two xerces strings are equal.

void writeCVS_ ( std::ostream &  os,
DoubleReal  value,
const String acc,
const String name,
int  indent = 4 
) const [inline, protected]

write cvParam containing strings to stream

value string value acc accession number defined by ontology name term defined by ontology indent number of tabs used in front of tag

Example: <cvParam cvLabel="psi" accession="PSI:acc" name="name" value="value"/>

void writeCVS_ ( std::ostream &  os,
const String value,
const String acc,
const String name,
int  indent = 4 
) const [inline, protected]

write cvParam containing strings to stream

value string value acc accession number defined by ontology name term defined by ontology indent number of tabs used in front of tag

Example: <cvParam cvLabel="psi" accession="PSI:acc" name="name" value="value"/>

void writeCVS_ ( std::ostream &  os,
int  value,
int  map,
const String acc,
const String name,
int  indent = 4 
) [protected]

write cvParam element to stream

os Output stream value enumeration value map index if the terms in cv_terms_ acc accession number defined by ontology name term defined by ontology indent number of tabs used in front of tag

Example: <cvParam cvLabel="psi" accession="PSI:acc" name="name" value=""/>

void writeUserParam_ ( std::ostream &  os,
const MetaInfoInterface meta,
int  indent = 4 
) [inline, protected]

Writing the MetaInfo as UserParam to the file.

void writeUserParam_ ( const String tag_name,
std::ostream &  os,
const MetaInfoInterface meta,
UInt  indent 
) const [protected]

Writes the content of MetaInfoInterface to the file.

UInt cvStringToEnum_ ( UInt  section,
const String term,
const char *  message 
) [inline, protected]

Converts term to the index of the term in the cv_terms_ entry section.

Int asInt_ ( const String in  )  [inline, protected]

Conversion of a String to an integer value.

Int asInt_ ( const XMLCh *  in  )  [inline, protected]

Conversion of a Xerces string to an integer value.

UInt asUInt_ ( const String in  )  [inline, protected]

Conversion of a String to an unsigned integer value.

double asDouble_ ( const String in  )  [inline, protected]

Conversion of a String to a double value.

float asFloat_ ( const String in  )  [inline, protected]

Conversion of a String to a float value.

bool asBool_ ( const String in  )  [inline, protected]

Conversion of a String to a bool value.

DateTime asDateTime_ ( const String in  )  [inline, protected]

Conversion of a String to a DataTime value.

char* attributeAsString_ ( const xercesc::Attributes &  a,
const char *  name 
) const [inline, protected]

Converts an attribute to a String.

Int attributeAsInt_ ( const xercesc::Attributes &  a,
const char *  name 
) const [inline, protected]

Converts an attribute to a Int.

DoubleReal attributeAsDouble_ ( const xercesc::Attributes &  a,
const char *  name 
) const [inline, protected]

Converts an attribute to a DoubleReal.

void optionalAttributeAsString_ ( String value,
const xercesc::Attributes &  a,
const char *  name 
) const [inline, protected]

Assigns the attribute content to the String value if the attribute is present.

void optionalAttributeAsInt_ ( Int value,
const xercesc::Attributes &  a,
const char *  name 
) const [inline, protected]

Assigns the attribute content to the Int value if the attribute is present.

void optionalAttributeAsUInt_ ( UInt value,
const xercesc::Attributes &  a,
const char *  name 
) const [inline, protected]

Assigns the attribute content to the UInt value if the attribute is present.

void optionalAttributeAsDouble_ ( DoubleReal value,
const xercesc::Attributes &  a,
const char *  name 
) const [inline, protected]

Assigns the attribute content to the DoubleReal value if the attribute is present.

char* attributeAsString_ ( const xercesc::Attributes &  a,
const XMLCh *  name 
) const [inline, protected]

Converts an attribute to a String.

Int attributeAsInt_ ( const xercesc::Attributes &  a,
const XMLCh *  name 
) const [inline, protected]

Converts an attribute to a Int.

DoubleReal attributeAsDouble_ ( const xercesc::Attributes &  a,
const XMLCh *  name 
) const [inline, protected]

Converts an attribute to a DoubleReal.

void optionalAttributeAsString_ ( String value,
const xercesc::Attributes &  a,
const XMLCh *  name 
) const [inline, protected]

Assigns the attribute content to the String value if the attribute is present.

void optionalAttributeAsInt_ ( Int value,
const xercesc::Attributes &  a,
const XMLCh *  name 
) const [inline, protected]

Assigns the attribute content to the Int value if the attribute is present.

void optionalAttributeAsUInt_ ( UInt value,
const xercesc::Attributes &  a,
const XMLCh *  name 
) const [inline, protected]

Assigns the attribute content to the UInt value if the attribute is present.

void optionalAttributeAsDouble_ ( DoubleReal value,
const xercesc::Attributes &  a,
const XMLCh *  name 
) const [inline, protected]

Assigns the attribute content to the DoubleReal value if the attribute is present.


Member Data Documentation

String error_message_ [mutable, protected]

Error message of the last error.

String file_ [protected]

File name.

String version_ [protected]

Schema version.

StringManager sm_ [protected]

Helper class for string conversion.

std::vector<String> open_tags_ [protected]

Stack of open XML tags.

This member is used only in those XML parsers that need this information.

std::vector< std::vector<String> > cv_terms_ [protected]

Array of CV term lists (one sublist denotes one term and it's children).


The documentation for this class was generated from the following file:
Generated Tue Apr 1 15:36:49 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1