diff -r 000000000000 -r 638b9c697799 apicompatanamdw/compatanalysercmd/libraryanalyser/inc/xmlsaxHandler.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/apicompatanamdw/compatanalysercmd/libraryanalyser/inc/xmlsaxHandler.hpp Tue Jan 12 14:52:39 2010 +0530 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include +#include "xmlstringtostlstring.hpp" + +#if !defined XMLSAXHANDLER + #define XMLSAXHANDLER + +// Forward Reference +//class AttributeList; +class XMLNode; + +// T - Domain Map +template +class XMLSAXHandler : public HandlerBase +{ + typedef T* root; +public: + XMLSAXHandler(); + virtual ~XMLSAXHandler(); + + T& getDomainMap() { return dataMap; } + + XMLNode& getRootElement() { return dataMap.root(); } + + // Handlers for the SAX DocumentHandler interface + virtual void startElement(const XMLCh* const name, AttributeList& attributes); + virtual void characters(const XMLCh* const chars, const unsigned int length); + virtual void ignorableWhitespace(const XMLCh* const chars, const unsigned int length); + virtual void endElement(const XMLCh* const name); +// void ignoreElement(const XMLCh* const aName); + +private: + // Private data members + T dataMap; +// T name ; +}; + +template +XMLSAXHandler::XMLSAXHandler() +{ +} + +template +XMLSAXHandler::~XMLSAXHandler() +{ +} + +// SAXParser: Implementation of the SAX DocumentHandler interface +template +void XMLSAXHandler::startElement(const XMLCh* const name, AttributeList& attributes) +{ + XMLStringToSTLString str(name); + const XMLCh* value = NULL; + + int length = attributes.getLength(); + for(int i=0;i +void XMLSAXHandler::endElement(const XMLCh* const name) +{ + XMLStringToSTLString str(name); + dataMap.add(str.data()); +} + +template +void XMLSAXHandler::characters(const XMLCh* const chars, const unsigned length) +{ + XMLStringToSTLString str(chars); + dataMap.updateAttribute(str.data()); +} + +template +void XMLSAXHandler::ignorableWhitespace( const XMLCh* const chars, const unsigned int length) +{ +} +/* +template +void XMLSAXHandler::ignoreElement(const XMLCh* const aName) +{ + name = aName; +}*/ + +#endif // XMLSAXHANDLER