org::xmlBlaster::util::parser::XmlHandlerBase Class Reference

Abstraction for the xml handling. More...

Collaboration diagram for org::xmlBlaster::util::parser::XmlHandlerBase:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 XmlHandlerBase (org::xmlBlaster::util::Global &global)
 Constructs an new object.
virtual ~XmlHandlerBase ()
void init (std::string &xmlLiteral)
std::string getLocale ()
 Get the locale (the xerces default is "en_US").
std::string toString ()
 
Returns:
returns the literal xml std::string

std::string toXml ()
 
Returns:
returns the literal xml std::string

virtual void startDocument ()
 Start document.
virtual void startElement (std::string &name, AttributeMap &attrs)
 Start element.
virtual void characters (std::string &ch)
 Characters.
virtual void endElement (std::string &name)
 End element.
virtual void endDocument ()
 End document.
virtual void warning (std::string &exTxt)
 Warning.
virtual void error (std::string &exTxt)
 Error.
virtual void fatalError (std::string &exTxt)
 Fatal error.
virtual void endCDATA ()
virtual void startCDATA ()
int getIntValue (std::string &value)
 returns a value (usually from an attribute) as an integer
long getLongValue (std::string &value)
 returns a value (usually from an attribute) as a long
Timestamp getTimestampValue (std::string &value)
 returns a value (usually from an attribute) as a Timestamp
bool getBoolValue (std::string &value)
 returns a value (usually from an attribute) as a bool
bool getStringAttr (AttributeMap &attrs, std::string &name, std::string &value, bool doTrim=true)
 gets the attribute specified by 'name' in the attribute list specified by 'list'.
bool getIntAttr (AttributeMap &attrs, std::string &name, int &value)
 gets the attribute specified by 'name' in the attribute list specified by 'list'.
bool getLongAttr (AttributeMap &attrs, std::string &name, long &value)
 gets the attribute specified by 'name' in the attribute list specified by 'list'.
bool getTimestampAttr (AttributeMap &attrs, std::string &name, Timestamp &value)
 gets the attribute specified by 'name' in the attribute list specified by 'list'.
bool getBoolAttr (AttributeMap &attrs, std::string &name, bool &value)
 gets the attribute specified by 'name' in the attribute list specified by 'list'.

Protected Member Functions

std::string getStartElementAsString (std::string &name, AttributeMap &attrMap)

Protected Attributes

std::string character_
std::string attributeCharacter_
bool inAttribute_
bool doTrimStrings_
org::xmlBlaster::util::StringTrim trimmer_
std::string locale_
std::string xmlLiteral_
 The original XML std::string in ASCII representation, for example: <qos></qos>".
org::xmlBlaster::util::Globalglobal_
org::xmlBlaster::util::I_Loglog_
org::xmlBlaster::util::thread::Mutex invocationMutex_

Detailed Description

Abstraction for the xml handling.

You may use this as the interface to extend in your specific XML handling (example SAX2).

Definition at line 28 of file XmlHandlerBase.h.


Constructor & Destructor Documentation

org::xmlBlaster::util::parser::XmlHandlerBase::XmlHandlerBase ( org::xmlBlaster::util::Global global  ) 

Constructs an new object.

You need to call the init() method to parse the XML std::string.

virtual org::xmlBlaster::util::parser::XmlHandlerBase::~XmlHandlerBase (  )  [virtual]

Definition at line 66 of file XmlHandlerBase.h.


Member Function Documentation

std::string org::xmlBlaster::util::parser::XmlHandlerBase::getStartElementAsString ( std::string &  name,
AttributeMap attrMap 
) [protected]

void org::xmlBlaster::util::parser::XmlHandlerBase::init ( std::string &  xmlLiteral  ) 

std::string org::xmlBlaster::util::parser::XmlHandlerBase::getLocale (  ) 

Get the locale (the xerces default is "en_US").

Others are "de_DE.iso-8859-1" or "en_US.UTF-8"

std::string org::xmlBlaster::util::parser::XmlHandlerBase::toString (  ) 

Returns:
returns the literal xml std::string

Definition at line 83 of file XmlHandlerBase.h.

std::string org::xmlBlaster::util::parser::XmlHandlerBase::toXml (  ) 

Returns:
returns the literal xml std::string

Definition at line 91 of file XmlHandlerBase.h.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::startDocument (  )  [virtual]

Start document.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::startElement ( std::string &  name,
AttributeMap attrs 
) [virtual]

Start element.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::characters ( std::string &  ch  )  [virtual]

Characters.

The text between two tags, in the following example 'Hello': <key>Hello</key>. This method is different from the java version since the c++ parser always starts at the first character, so you don't specify start.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::endElement ( std::string &  name  )  [virtual]

End element.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::endDocument (  )  [virtual]

End document.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::warning ( std::string &  exTxt  )  [virtual]

Warning.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::error ( std::string &  exTxt  )  [virtual]

Error.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::fatalError ( std::string &  exTxt  )  [virtual]

Fatal error.

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::endCDATA (  )  [virtual]

virtual void org::xmlBlaster::util::parser::XmlHandlerBase::startCDATA (  )  [virtual]

int org::xmlBlaster::util::parser::XmlHandlerBase::getIntValue ( std::string &  value  ) 

returns a value (usually from an attribute) as an integer

long org::xmlBlaster::util::parser::XmlHandlerBase::getLongValue ( std::string &  value  ) 

returns a value (usually from an attribute) as a long

Timestamp org::xmlBlaster::util::parser::XmlHandlerBase::getTimestampValue ( std::string &  value  ) 

returns a value (usually from an attribute) as a Timestamp

bool org::xmlBlaster::util::parser::XmlHandlerBase::getBoolValue ( std::string &  value  ) 

returns a value (usually from an attribute) as a bool

bool org::xmlBlaster::util::parser::XmlHandlerBase::getStringAttr ( AttributeMap attrs,
std::string &  name,
std::string &  value,
bool  doTrim = true 
)

gets the attribute specified by 'name' in the attribute list specified by 'list'.

The result is put in the 'value' argument which is passed by reference. It returns 'true' if the attribute was found in the specified attribute list or 'false' if it was not. In the later case, the value is untouched by this method. If the 'doTrim' argument is set to true, the std::string is trimmed before it is given back.

bool org::xmlBlaster::util::parser::XmlHandlerBase::getIntAttr ( AttributeMap attrs,
std::string &  name,
int &  value 
)

gets the attribute specified by 'name' in the attribute list specified by 'list'.

The result is put in the 'value' argument which is passed by reference. It returns 'true' if the attribute was found in the specified attribute list or 'false' if it was not. In the later case, the value is untouched by this method.

bool org::xmlBlaster::util::parser::XmlHandlerBase::getLongAttr ( AttributeMap attrs,
std::string &  name,
long &  value 
)

gets the attribute specified by 'name' in the attribute list specified by 'list'.

The result is put in the 'value' argument which is passed by reference. It returns 'true' if the attribute was found in the specified attribute list or 'false' if it was not. In the later case, the value is untouched by this method.

bool org::xmlBlaster::util::parser::XmlHandlerBase::getTimestampAttr ( AttributeMap attrs,
std::string &  name,
Timestamp value 
)

gets the attribute specified by 'name' in the attribute list specified by 'list'.

The result is put in the 'value' argument which is passed by reference. It returns 'true' if the attribute was found in the specified attribute list or 'false' if it was not. In the later case, the value is untouched by this method.

bool org::xmlBlaster::util::parser::XmlHandlerBase::getBoolAttr ( AttributeMap attrs,
std::string &  name,
bool &  value 
)

gets the attribute specified by 'name' in the attribute list specified by 'list'.

The result is put in the 'value' argument which is passed by reference. It returns 'true' if the attribute was found in the specified attribute list or 'false' if it was not. In the later case, the value is untouched by this method.


Member Data Documentation

std::string org::xmlBlaster::util::parser::XmlHandlerBase::character_ [protected]

Definition at line 40 of file XmlHandlerBase.h.

std::string org::xmlBlaster::util::parser::XmlHandlerBase::attributeCharacter_ [protected]

Definition at line 41 of file XmlHandlerBase.h.

bool org::xmlBlaster::util::parser::XmlHandlerBase::inAttribute_ [protected]

Definition at line 42 of file XmlHandlerBase.h.

bool org::xmlBlaster::util::parser::XmlHandlerBase::doTrimStrings_ [protected]

Definition at line 43 of file XmlHandlerBase.h.

org::xmlBlaster::util::StringTrim org::xmlBlaster::util::parser::XmlHandlerBase::trimmer_ [protected]

Definition at line 44 of file XmlHandlerBase.h.

std::string org::xmlBlaster::util::parser::XmlHandlerBase::locale_ [protected]

Definition at line 45 of file XmlHandlerBase.h.

std::string org::xmlBlaster::util::parser::XmlHandlerBase::xmlLiteral_ [protected]

The original XML std::string in ASCII representation, for example: <qos></qos>".

Definition at line 53 of file XmlHandlerBase.h.

org::xmlBlaster::util::Global& org::xmlBlaster::util::parser::XmlHandlerBase::global_ [protected]

Definition at line 54 of file XmlHandlerBase.h.

org::xmlBlaster::util::I_Log& org::xmlBlaster::util::parser::XmlHandlerBase::log_ [protected]

Definition at line 55 of file XmlHandlerBase.h.

org::xmlBlaster::util::thread::Mutex org::xmlBlaster::util::parser::XmlHandlerBase::invocationMutex_ [protected]

Definition at line 57 of file XmlHandlerBase.h.


The documentation for this class was generated from the following file: