SourceForge.net Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Examples

EventSerializer.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2008
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2008
00005  *     Oracle. All rights reserved.
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  *
00019  * $Id: EventSerializer.hpp 582 2008-08-11 16:43:58Z jpcs $
00020  */
00021 
00022 #ifndef _EVENTSERIALIZER_HPP
00023 #define _EVENTSERIALIZER_HPP
00024 
00025 #include <xqilla/events/EventHandler.hpp>
00026 
00027 #include <xercesc/framework/XMLFormatter.hpp>
00028 
00029 class XQILLA_API EventSerializer : public EventHandler
00030 {
00031 public:
00032   EventSerializer(const char *encoding, const char *xmlVersion, XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatTarget *target,
00033                   XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mm =
00034                   XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
00035   EventSerializer(XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatTarget *target,
00036                   XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mm =
00037                   XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
00038   ~EventSerializer();
00039 
00040   virtual void setLocationInfo(const LocationInfo *location) {}
00041 
00042   virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding);
00043   virtual void endDocumentEvent();
00044   virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname);
00045   virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
00046                                const XMLCh *typeURI, const XMLCh *typeName);
00047   virtual void piEvent(const XMLCh *target, const XMLCh *value);
00048   virtual void textEvent(const XMLCh *value);
00049   virtual void textEvent(const XMLCh *chars, unsigned int length);
00050   virtual void commentEvent(const XMLCh *value);
00051   virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
00052                               const XMLCh *typeURI, const XMLCh *typeName);
00053   virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri);
00054   virtual void atomicItemEvent(AnyAtomicType::AtomicObjectType type, const XMLCh *value,
00055                                const XMLCh *typeURI, const XMLCh *typeName);
00056   virtual void endEvent();
00057 
00058   void addNewlines(bool add) { addNewlines_ = add; }
00059   void useSelfClosingElement(bool value) { selfClosing_ = value; }
00060   void addXMLDeclarations(bool value) { xmlDecls_ = value; }
00061 
00062 private:
00063   XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatter formatter_;
00064   bool elementStarted_;
00065   unsigned int level_;
00066   XMLCh *version_, *encoding_;
00067   bool addNewlines_, selfClosing_, xmlDecls_;
00068   XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mm_;
00069 };
00070 
00071 #endif

Generated on Fri Sep 25 06:55:26 2009 for XQilla Simple API by  doxygen 1.3.9.1