Xalan-C++ API Reference 1.12.0
FormatterToXercesDOM.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(FORMATTERTOXERCESDOM_HEADER_GUARD_1357924680)
19#define FORMATTERTOXERCESDOM_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
29
30
31
32// Base class header file.
34
35
36
38
39
40
42
43
44
45namespace XALAN_CPP_NAMESPACE {
46
47
48
49/**
50 * This class takes SAX events (in addition to some extra events that SAX
51 * doesn't handle yet) and adds the result to a document or document fragment.
52 */
54{
55public:
56
57 /**
58 * Construct a FormatterToXercesDOM instance. it will add the DOM nodes
59 * to the document fragment.
60 *
61 * @param doc document for nodes
62 * @param docFrag document fragment for nodes
63 * @param currentElement current element for nodes
64 */
69 MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
70
71 /**
72 * Construct a FormatterToXercesDOM instance. it will add the DOM nodes
73 * to the document.
74 *
75 * @param doc document for nodes
76 * @param elem current element for nodes
77 */
81 MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
82
83 virtual
85
86
87 // These methods are inherited from FormatterListener...
88
89 virtual void
91 const XMLCh* const chars,
92 const size_type length);
93
94 virtual void
95 comment(const XMLCh* const data);
96
97 virtual void
99 const XMLCh* const ch,
100 const size_type length);
101
102 virtual void
104
105 virtual void
106 setDocumentLocator(const Locator* const locator);
107
108 virtual void
110
111 virtual void
113
114 virtual void
116 const XMLCh* const name,
118
119 virtual void
120 endElement(const XMLCh* const name);
121
122 virtual void
124 const XMLCh* const chars,
125 const size_type length);
126
127 virtual void
129 const XMLCh* const chars,
130 const size_type length);
131
132 virtual void
134 const XMLCh* const target,
135 const XMLCh* const data);
136
137 virtual void
139
142 {
143 return m_doc;
144 }
145
146 void
151
154 {
155 return m_docFrag;
156 }
157
158 void
163
166 {
167 return m_currentElem;
168 }
169
170 void
172 {
173 m_currentElem = theElement;
174 }
175
176private:
177
178 /**
179 * Process any accumulated text and create a node for it.
180 */
181 void
182 processAccumulatedText();
183
184 /**
185 * Append a node to the current container.
186 */
187 void
189
190 /**
191 * Create the appropriate element, complete with attributes set.
192 *
193 * @param theElementName The name for the new element
194 * @param attrs The SAX AttributeList for the new attributes.
195 * @return A pointer to the new instance.
196 */
198 createElement(
201
202 void
203 addAttributes(
206
207
208 // Data members...
209 DOMDocument_Type* m_doc;
210
211 DOMDocumentFragmentType* m_docFrag;
212
213 DOMElementType* m_currentElem;
214
215 typedef XalanVector<DOMElementType*> ElementStackType;
216
217 ElementStackType m_elemStack;
218
219 XalanDOMString m_buffer;
220
221 XalanDOMString m_textBuffer;
222
223 static const XalanDOMString s_emptyString;
224};
225
226
227
228}
229
230
231
232#endif // FORMATTERTODOM_HEADER_GUARD_1357924680
#define XALAN_DEFAULT_MEMMGR
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
#define XALAN_XERCESPARSERLIAISON_EXPORT
A SAX-based formatter interface for the XSL processor.
This class takes SAX events (in addition to some extra events that SAX doesn't handle yet) and adds t...
FormatterToXercesDOM(DOMDocument_Type *doc, DOMElementType *currentElement, MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
Construct a FormatterToXercesDOM instance.
virtual void charactersRaw(const XMLCh *const chars, const size_type length)
Receive notification of character data.
void setCurrentElement(DOMElementType *theElement)
virtual void processingInstruction(const XMLCh *const target, const XMLCh *const data)
void setDocument(DOMDocument_Type *theDocument)
virtual void endElement(const XMLCh *const name)
virtual void entityReference(const XMLCh *const name)
Receive notification of a entityReference.
virtual void characters(const XMLCh *const chars, const size_type length)
virtual void comment(const XMLCh *const data)
Called when a Comment is to be constructed.
DOMDocument_Type * getDocument() const
FormatterToXercesDOM(DOMDocument_Type *doc, DOMDocumentFragmentType *docFrag, DOMElementType *currentElement, MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
Construct a FormatterToXercesDOM instance.
virtual void startElement(const XMLCh *const name, AttributeListType &attrs)
virtual void setDocumentLocator(const Locator *const locator)
DOMDocumentFragmentType * getDocumentFragment() const
DOMElementType * getCurrentElement() const
virtual void cdata(const XMLCh *const ch, const size_type length)
Receive notification of cdata.
void setDocumentFragment(DOMDocumentFragmentType *theDocumentFragment)
virtual void ignorableWhitespace(const XMLCh *const chars, const size_type length)
xercesc::DOMDocument DOMDocument_Type
xercesc::DOMElement DOMElementType
xercesc::AttributeList AttributeListType
xercesc::DOMNode DOMNodeType
xercesc::DOMDocumentFragment DOMDocumentFragmentType
XalanDOMString & append(XalanDOMString &theString, const XalanDOMString &theStringToAppend)
Concatenate two strings.