2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUiEffects_ParserXMLParser.h
19 * @brief This file contains a declaration of XmlParser class
22 #ifndef _FUI_EFFECTS_INTERNAL_PARSER_XMLPARSER_H_
23 #define _FUI_EFFECTS_INTERNAL_PARSER_XMLPARSER_H_
25 #include <libxml/parser.h>
27 namespace Tizen { namespace Ui { namespace Effects { namespace _Parser
34 * @brief An intermediate functionality between tizen's xmlSAXHandler and EffectParser class
35 * Uses the former for parsing an .xml file and sends information to the latter
36 * Implemented according to the singleton pattern
51 XmlParser(EffectParser* pParent);
59 virtual ~XmlParser(void);
62 * Performs a complete parsing of an .xml file by usage xmlSAXHandler
66 * @return A boolean result of XML-parsing only
67 * @param[in] pFilePath - a full path to the input file
68 * @param[in] sendcallbacks - determines whether to send information to EffectParser
69 * or just to parse the input file
70 * @exception E_PARSING_FAILED XML parsing hasn't been successful
72 bool Parse(const char* pFilePath, bool sendCallbacks);
75 * Unzips a .zip-archive
79 * @param[in] pArchivePath - a full path to the archive
80 * @param[in] pDestinationPath - a path to the directory for the archive
83 static bool ExtractFromArchive(const char* pArchivePath, const char* pDestinationPath);
89 // Hidden copy constructor
90 XmlParser(const XmlParser& rhs);
92 // Hidden assignment operator
93 XmlParser& operator=(const XmlParser& rhs);
95 // SAX callback that handles an opening tag of a new element
96 static void StartElementNs(void * pCtx, const xmlChar* pLocalName, const xmlChar* pPrefix, const xmlChar* pUri,
97 int namespaceCount, const xmlChar** ppNamespaces, int attributeCount, int defaultedCount, const xmlChar** ppAttributes);
99 // SAX callback that handles a closing tag of an element
100 static void EndElementNs(void* pCtx, const xmlChar* pLocalName, const xmlChar* pPrefix, const xmlChar* pUri);
102 // SAX callback that handles precense of a text line inside some element
103 static void CharactersM(void* pCtx, const xmlChar* pCh, int len);
105 // SAX callback that handles a sax error message
106 static void Error(void* pCtx, const char* pMsg, ... );
108 // SAX callback that handles a sax warning
109 static void Warning(void* pCtx, const char* pMsg, ... );
113 static EffectParser* __pCurrentParent;
114 static bool __justParse;
117 } } } } // Tizen::Ui::Effects::_Parser
119 #endif //_FUI_EFFECTS_INTERNAL_PARSER_XMLPARSER_H_