00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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