COPASI API  4.40.278
CXMLParser Class Reference

#include <CXMLParser.h>

Inheritance diagram for CXMLParser:
[legend]

Public Member Functions

 CXMLParser (CVersion &version)
 
void enableCharacterDataHandler (bool fEnable=true)
 
std::string getCharacterData (const std::string &toBeStripped="", const std::string &join=" ")
 
const CCopasiParameterGroupgetCurrentGroup () const
 
CXMLHandlergetHandler (const CXMLHandler::Type &type)
 
CListOfLayoutsgetLayoutList () const
 
CModelgetModel () const
 
COutputDefinitionVectorgetPlotList () const
 
CReportDefinitionVectorgetReportList () const
 
CDataVectorN< CCopasiTask > * getTaskList () const
 
CUnitDefinitionDBgetUnitDefinitionImportList () const
 
virtual void onCharacterData (const XML_Char *pszData, int nLength)
 
virtual void onEndElement (const XML_Char *pszName)
 
virtual void onSkippedEntityHandler (const XML_Char *entityName, int is_parameter_entity)
 
virtual void onStartElement (const XML_Char *pszName, const XML_Char **papszAttrs)
 
void popElementHandler ()
 
void pushElementHandler (CXMLHandler *pElementHandler)
 
void setCharacterEncoding (const CCopasiXMLInterface::EncodingType &encoding)
 
void setDatamodel (CDataModel *pDataModel)
 
void setFunctionList (CDataVectorN< CFunction > *pFunctionList)
 
void setGUI (SCopasiXMLGUI *pGUI)
 
void setLayoutList (CListOfLayouts *pLayoutList)
 
 ~CXMLParser ()
 
- Public Member Functions inherited from CExpat
 CExpat ()
 
virtual void onComment (const XML_Char *pszData)
 
virtual void onDefault (const XML_Char *pszData, int nLength)
 
virtual void onEndCdataSection ()
 
virtual void onEndDoctypeDecl ()
 
virtual void onEndNamespaceDecl (const XML_Char *pszPrefix)
 
virtual bool onExternalEntityRef (const XML_Char *pszContext, const XML_Char *pszBase, const XML_Char *pszSystemID, const XML_Char *pszPublicID)
 
virtual void onProcessingInstruction (const XML_Char *pszTarget, const XML_Char *pszData)
 
virtual void onStartCdataSection ()
 
virtual void onStartDoctypeDecl (const XML_Char *pszDoctypeName, const XML_Char *pszSysID, const XML_Char *pszPubID, bool fHasInternalSubset)
 
virtual void onStartNamespaceDecl (const XML_Char *pszPrefix, const XML_Char *pszURI)
 
virtual bool onUnknownEncoding (const XML_Char *pszName, XML_Encoding *pInfo)
 
virtual void onXmlDecl (const XML_Char *pszVersion, const XML_Char *pszEncoding, bool fStandalone)
 
virtual ~CExpat ()
 
- Public Member Functions inherited from CExpatTemplate< CExpat >
 CExpatTemplate ()
 
bool create (const XML_Char *pszEncoding=NULL, const XML_Char *pszSep=NULL)
 
void destroy ()
 
void enableCdataSectionHandler (bool fEnable=true)
 
void enableCharacterDataHandler (bool fEnable=true)
 
void enableCommentHandler (bool fEnable=true)
 
void enableDefaultHandler (bool fEnable=true, bool fExpand=true)
 
void enableDoctypeDeclHandler (bool fEnable=true)
 
void enableElementHandler (bool fEnable=true)
 
void enableEndCdataSectionHandler (bool fEnable=true)
 
void enableEndDoctypeDeclHandler (bool fEnable=true)
 
void enableEndElementHandler (bool fEnable=true)
 
void enableEndNamespaceDeclHandler (bool fEnable=true)
 
void enableExternalEntityRefHandler (bool fEnable=true)
 
void enableNamespaceDeclHandler (bool fEnable=true)
 
void enableProcessingInstructionHandler (bool fEnable=true)
 
void enableSkippedEntityHandler (bool fEnable=true)
 
void enableStartCdataSectionHandler (bool fEnable=true)
 
void enableStartDoctypeDeclHandler (bool fEnable=true)
 
void enableStartElementHandler (bool fEnable=true)
 
void enableStartNamespaceDeclHandler (bool fEnable=true)
 
void enableUnknownEncodingHandler (bool fEnable=true)
 
void enableXmlDeclHandler (bool fEnable=true)
 
const char * getAttributeValue (const std::string &name, const char **attributes, const bool &required=true) const
 
const char * getAttributeValue (const std::string &name, const char **attributes, const char *def) const
 
void * getBuffer (int nLength)
 
int getCurrentByteCount ()
 
long getCurrentByteIndex ()
 
int getCurrentColumnNumber ()
 
int getCurrentLineNumber () const
 
enum XML_Error getErrorCode ()
 
const XML_LChar * getErrorString ()
 
const char * getInputContext (int *pnOffset, int *pnSize)
 
void onCharacterData (const XML_Char *pszData, int nLength)
 
void onComment (const XML_Char *pszData)
 
void onDefault (const XML_Char *pszData, int nLength)
 
void onEndCdataSection ()
 
void onEndDoctypeDecl ()
 
void onEndElement (const XML_Char *pszName)
 
void onEndNamespaceDecl (const XML_Char *pszPrefix)
 
bool onExternalEntityRef (const XML_Char *pszContext, const XML_Char *pszBase, const XML_Char *pszSystemID, const XML_Char *pszPublicID)
 
void onProcessingInstruction (const XML_Char *pszTarget, const XML_Char *pszData)
 
void onSkippedEntityHandler (const XML_Char *, int)
 
void onStartCdataSection ()
 
void onStartDoctypeDecl (const XML_Char *pszDoctypeName, const XML_Char *pszSysID, const XML_Char *pszPubID, bool fHasInternalSubset)
 
void onStartElement (const XML_Char *pszName, const XML_Char **papszAttrs)
 
void onStartNamespaceDecl (const XML_Char *pszPrefix, const XML_Char *pszURI)
 
bool onUnknownEncoding (const XML_Char *pszName, XML_Encoding *pInfo)
 
void onXmlDecl (const XML_Char *pszVersion, const XML_Char *pszEncoding, bool fStandalone)
 
bool parse (const char *pszBuffer, int nLength=-1, bool fIsFinal=true)
 
bool parseBuffer (int nLength, bool fIsFinal=true)
 
 ~CExpatTemplate ()
 

Private Member Functions

 CXMLParser ()
 

Private Attributes

std::string mCharacterData
 
CCopasiXMLInterface::EncodingType mCharacterDataEncoding
 
CXMLParserData mData
 
std::stack< CXMLHandler * > mElementHandlerStack
 
CXMLHandlerFactorympFactory
 

Additional Inherited Members

- Static Public Member Functions inherited from CExpatTemplate< CExpat >
static const XML_LChar * getErrorString (enum XML_Error nError)
 
static const XML_LChar * getExpatVersion ()
 
static void getExpatVersion (int &nMajor, int &nMinor, int &nMicro)
 
static bool toBool (const char *attribute)
 
- Protected Member Functions inherited from CExpatTemplate< CExpat >
void onPostCreate ()
 
- Static Protected Member Functions inherited from CExpatTemplate< CExpat >
static void characterDataHandler (void *pUserData, const XML_Char *pszData, int nLength)
 
static void commentHandler (void *pUserData, const XML_Char *pszData)
 
static void defaultHandler (void *pUserData, const XML_Char *pszData, int nLength)
 
static void endCdataSectionHandler (void *pUserData)
 
static void endDoctypeDeclHandler (void *pUserData)
 
static void endElementHandler (void *pUserData, const XML_Char *pszName)
 
static void endNamespaceDeclHandler (void *pUserData, const XML_Char *pszPrefix)
 
static int externalEntityRefHandler (XML_Parser pUserData, const XML_Char *pszContext, const XML_Char *pszBase, const XML_Char *pszSystemID, const XML_Char *pszPublicID)
 
static void processingInstructionHandler (void *pUserData, const XML_Char *pszTarget, const XML_Char *pszData)
 
static void skippedEntityHandler (void *pUserData, const XML_Char *entityName, int is_parameter_entity)
 
static void startCdataSectionHandler (void *pUserData)
 
static void startDoctypeDeclHandler (void *pUserData, const XML_Char *pszDoctypeName, const XML_Char *pszSysID, const XML_Char *pszPubID, int nHasInternalSubset)
 
static void startElementHandler (void *pUserData, const XML_Char *pszName, const XML_Char **papszAttrs)
 
static void startNamespaceDeclHandler (void *pUserData, const XML_Char *pszPrefix, const XML_Char *pszURI)
 
static int unknownEncodingHandler (void *pUserData, const XML_Char *pszName, XML_Encoding *pInfo)
 
static void xmlDeclHandler (void *pUserData, const XML_Char *pszVersion, const XML_Char *pszEncoding, int nStandalone)
 
- Protected Attributes inherited from CExpatTemplate< CExpat >
XML_Parser mParser
 

Detailed Description

CXMLParser class. This class is the parses a COPASI XML file.

Created for COPASI by Stefan Hoops 2003 Copyright Stefan Hoops

Constructor & Destructor Documentation

◆ CXMLParser() [1/2]

CXMLParser::CXMLParser ( )
private

Constructor

◆ CXMLParser() [2/2]

CXMLParser::CXMLParser ( CVersion version)

Public constructor

Parameters
CVersion& version

CXMLParser class. This class parses a COPASI XML file.

Created for COPASI by Stefan Hoops 2003 Copyright Stefan Hoops

References CXMLHandler::COPASI, CExpatTemplate< CExpat >::create(), CExpatTemplate< CExpat >::enableElementHandler(), CXMLHandlerFactory::getHandler(), mData, mElementHandlerStack, mpFactory, and CXMLParserData::pVersion.

◆ ~CXMLParser()

CXMLParser::~CXMLParser ( )

Member Function Documentation

◆ enableCharacterDataHandler()

◆ getCharacterData()

std::string CXMLParser::getCharacterData ( const std::string &  toBeStripped = "",
const std::string &  join = " " 
)

Retrieve the data. Any sequence of toBeStripped characters is replaced by a single join character. The default is no stripping.

Parameters
conststd::string & toBeStripped (default: "")
conststd::string & join (default: " ")
Returns
std::string data

References enableCharacterDataHandler(), and mCharacterData.

Referenced by CharacterDataHandler::processEnd(), CommentHandler::processEnd(), MiriamAnnotationHandler::processEnd(), UnsupportedAnnotationHandler::processEnd(), CommentHandler::processStart(), MiriamAnnotationHandler::processStart(), and UnsupportedAnnotationHandler::processStart().

◆ getCurrentGroup()

const CCopasiParameterGroup * CXMLParser::getCurrentGroup ( ) const

Retrieve a pointer to the current group if available

Returns
const CCopasiParameterGroup * currentGroup

References mData, and CXMLParserData::pCurrentParameter.

Referenced by CConfigurationFile::CXML::load().

◆ getHandler()

CXMLHandler * CXMLParser::getHandler ( const CXMLHandler::Type type)

◆ getLayoutList()

CListOfLayouts * CXMLParser::getLayoutList ( ) const

Retrieve the list of loaded layouts

Returns
CListOfLayouts * pLayoutList

References mData, and CXMLParserData::pLayoutList.

Referenced by CCopasiXML::load().

◆ getModel()

CModel * CXMLParser::getModel ( ) const

Retrieve the loaded model functions

Returns
CModel * pModel

References mData, and CXMLParserData::pModel.

Referenced by CCopasiXML::load().

◆ getPlotList()

COutputDefinitionVector * CXMLParser::getPlotList ( ) const

Retrieve the list of loaded functions

Returns
COutputDefinitionVector * pPlotList

References mData, and CXMLParserData::pPlotList.

Referenced by CCopasiXML::load().

◆ getReportList()

CReportDefinitionVector * CXMLParser::getReportList ( ) const

Retrieve the list of loaded reports

Returns
CReportDefinitionVector * pReportList

References mData, and CXMLParserData::pReportList.

Referenced by CCopasiXML::load().

◆ getTaskList()

CDataVectorN< CCopasiTask > * CXMLParser::getTaskList ( ) const

Retrieve the list of loaded functions

Returns
CDataVectorN< CTask > * pTaskList

References mData, and CXMLParserData::pTaskList.

Referenced by CCopasiXML::load().

◆ getUnitDefinitionImportList()

CUnitDefinitionDB * CXMLParser::getUnitDefinitionImportList ( ) const

Retrieve Unit Definitions to be added to the Root Container's global list.

Returns
CUnitDefinitionDB * pUnitDefinitionImportList

References mData, and CXMLParserData::pUnitDefinitionImportList.

Referenced by CCopasiXML::load().

◆ onCharacterData()

void CXMLParser::onCharacterData ( const XML_Char *  pszData,
int  nLength 
)
virtual

Character data handler

Parameters
constXML_Char *pszData
intnLength

Reimplemented from CExpat.

References CCopasiXMLInterface::encode(), mCharacterData, and mCharacterDataEncoding.

◆ onEndElement()

void CXMLParser::onEndElement ( const XML_Char *  pszName)
virtual

◆ onSkippedEntityHandler()

void CXMLParser::onSkippedEntityHandler ( const XML_Char *  entityName,
int  is_parameter_entity 
)
virtual

Skipped entity handler This is called in two situations: 1) An entity reference is encountered for which no declaration has been read and this is not an error. 2) An internal entity reference is read, but not expanded, because XML_SetDefaultHandler has been called. Note: skipped parameter entities in declarations and skipped general entities in attribute values cannot be reported, because the event would be out of sync with the reporting of the declarations or attribute values

Parameters
constXML_Char *entityName
intis_parameter_entity

Reimplemented from CExpat.

References mCharacterData.

◆ onStartElement()

void CXMLParser::onStartElement ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Reimplemented from CExpat.

References CExpatTemplate< CExpat >::getCurrentLineNumber(), and mElementHandlerStack.

Referenced by CXMLHandler::start().

◆ popElementHandler()

void CXMLParser::popElementHandler ( )

◆ pushElementHandler()

void CXMLParser::pushElementHandler ( CXMLHandler pElementHandler)

Push the element handler on the stack.

Parameters
CXMLHandler* pElementHandler

References mElementHandlerStack.

Referenced by CXMLHandler::start().

◆ setCharacterEncoding()

void CXMLParser::setCharacterEncoding ( const CCopasiXMLInterface::EncodingType encoding)

◆ setDatamodel()

void CXMLParser::setDatamodel ( CDataModel pDataModel)

Set the datamodel.

Parameters
CDataModel*pDataModel

References mData, and CXMLParserData::pDataModel.

Referenced by CCopasiXML::load().

◆ setFunctionList()

void CXMLParser::setFunctionList ( CDataVectorN< CFunction > *  pFunctionList)

Set the list of loaded functions

Parameters
CDataVectorN<CFunction > * pFunctionList

References mData, and CXMLParserData::pFunctionList.

Referenced by CCopasiXML::load().

◆ setGUI()

void CXMLParser::setGUI ( SCopasiXMLGUI pGUI)

Set the GUI information to be saved

Parameters
SCopasiXMLGUI* pGUI

References mData, and CXMLParserData::pGUI.

Referenced by CCopasiXML::load().

◆ setLayoutList()

void CXMLParser::setLayoutList ( CListOfLayouts pLayoutList)

Set the list of loaded layouts

Parameters
CListOfLayouts* pLayoutList

References mData, and CXMLParserData::pLayoutList.

Referenced by CCopasiXML::load().

Member Data Documentation

◆ mCharacterData

std::string CXMLParser::mCharacterData
private

◆ mCharacterDataEncoding

CCopasiXMLInterface::EncodingType CXMLParser::mCharacterDataEncoding
private

The character data.

Referenced by onCharacterData(), and setCharacterEncoding().

◆ mData

◆ mElementHandlerStack

std::stack< CXMLHandler * > CXMLParser::mElementHandlerStack
private

The element handler stack

Referenced by CXMLParser(), onEndElement(), onStartElement(), popElementHandler(), and pushElementHandler().

◆ mpFactory

CXMLHandlerFactory* CXMLParser::mpFactory
private

The handler factory managing all needed handlers

Referenced by CXMLParser(), getHandler(), and ~CXMLParser().


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