SourceForge.net Logo
EventSerializer.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2001, 2008,
3 * DecisionSoft Limited. All rights reserved.
4 * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
5 *
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef _EVENTSERIALIZER_HPP
21#define _EVENTSERIALIZER_HPP
22
24
26
27class XQILLA_API EventSerializer : public EventHandler
28{
29public:
30 EventSerializer(const char *encoding, const char *xmlVersion, XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatTarget *target,
31 XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mm =
32 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
33 EventSerializer(XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatTarget *target,
34 XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mm =
35 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
37
38 virtual void setLocationInfo(const LocationInfo *location) {}
39
40 virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding);
41 virtual void endDocumentEvent();
42 virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname);
43 virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
44 const XMLCh *typeURI, const XMLCh *typeName);
45 virtual void piEvent(const XMLCh *target, const XMLCh *value);
46 virtual void textEvent(const XMLCh *value);
47 virtual void textEvent(const XMLCh *chars, unsigned int length);
48 virtual void commentEvent(const XMLCh *value);
49 virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
50 const XMLCh *typeURI, const XMLCh *typeName);
51 virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri);
52 virtual void atomicItemEvent(AnyAtomicType::AtomicObjectType type, const XMLCh *value,
53 const XMLCh *typeURI, const XMLCh *typeName);
54 virtual void endEvent();
55
56 void addNewlines(bool add) { addNewlines_ = add; }
57 void useSelfClosingElement(bool value) { selfClosing_ = value; }
58 void addXMLDeclarations(bool value) { xmlDecls_ = value; }
59
60private:
61 XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatter formatter_;
62 bool elementStarted_;
63 unsigned int level_;
64 XMLCh *version_, *encoding_;
65 bool addNewlines_, selfClosing_, xmlDecls_;
66 XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mm_;
67};
68
69#endif
AtomicObjectType
Definition AnyAtomicType.hpp:34
Definition EventHandler.hpp:30
Definition EventSerializer.hpp:28
virtual void endEvent()
Called when all events have been reported.
EventSerializer(xercesc::XMLFormatTarget *target, xercesc::MemoryManager *mm=xercesc::XMLPlatformUtils::fgMemoryManager)
virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *typeURI, const XMLCh *typeName)
Handles the end of an element node as an event.
virtual void endDocumentEvent()
Handles a document node as an event.
EventSerializer(const char *encoding, const char *xmlVersion, xercesc::XMLFormatTarget *target, xercesc::MemoryManager *mm=xercesc::XMLPlatformUtils::fgMemoryManager)
virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value, const XMLCh *typeURI, const XMLCh *typeName)
Handles an attribute node as an event.
virtual void textEvent(const XMLCh *value)
Handles a text node as an event.
virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding)
Handles a document node as an event.
virtual void setLocationInfo(const LocationInfo *location)
Recieves a LocationInfo object that is owned by the caller, and will be updated with the current loca...
Definition EventSerializer.hpp:38
void useSelfClosingElement(bool value)
Definition EventSerializer.hpp:57
virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri)
Handles a namespace binding as an event.
void addNewlines(bool add)
Definition EventSerializer.hpp:56
void addXMLDeclarations(bool value)
Definition EventSerializer.hpp:58
virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname)
Handles the start of an element node as an event.
virtual void atomicItemEvent(AnyAtomicType::AtomicObjectType type, const XMLCh *value, const XMLCh *typeURI, const XMLCh *typeName)
Handles an atomic item as an event.
virtual void commentEvent(const XMLCh *value)
Handles a comment node as an event.
virtual void textEvent(const XMLCh *chars, unsigned int length)
Handles a text node as an event.
virtual void piEvent(const XMLCh *target, const XMLCh *value)
Handles a processing instruction node as an event.
A class that gives records a location in the query.
Definition LocationInfo.hpp:30