2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Class implements DOM fragment functionality
25 #ifndef SEN_DOM_FRAGMENT_H
26 #define SEN_DOM_FRAGMENT_H
29 #include <SenBaseFragment.h>
31 // FORWARD DECLARATIONS
37 * Class implements DOM fragment functionality
38 * The implementation further extends CSenBaseFragment
39 * functionality. In DOM fragment, all child elements
40 * are parsed into separate element objects. This makes
41 * it possible to reference any child which offer methods
42 * declared in XML element interface. Any such element
43 * can also be easily extracted (detached) from this
48 class CSenDomFragment : public CSenBaseFragment
50 public: // Constructors and destructor
53 * Basic contructor. Should be used only for parsing new fragments etc.
54 * Constructing DomFragments for other use should be done with at least
55 * localname parameter.
58 IMPORT_C static CSenDomFragment* NewL();
63 * @param aElement Element to copy construction data from.
65 IMPORT_C static CSenDomFragment* NewL(
66 const CSenElement& aElement);
71 * @param aLocalName is the XML localname of this fragment
73 * KErrSenInvalidCharacters if aLocalName contains
75 * KErrSenZeroLengthDescriptor if aLocalName is zero length.
77 IMPORT_C static CSenDomFragment* NewL(const TDesC8& aLocalName);
82 * @param aNsUri is the XML namespace user of this fragment
83 * @param aLocalName is the XML localname of this fragment
85 * KErrSenInvalidCharacters if aLocalName contains
87 * KErrSenZeroLengthDescriptor if aLocalName is zero length.
89 IMPORT_C static CSenDomFragment* NewL(const TDesC8& aNsUri,
90 const TDesC8& aLocalName);
95 * @param aNsUri is the XML namespace user of this fragment
96 * @param aLocalName is the XML localname of this fragment
97 * @param aQName is the XML qualifiedname of this fragment
99 * KErrSenInvalidCharacters if aLocalName or aQName contains
100 * illegal characters.
101 * KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
103 IMPORT_C static CSenDomFragment* NewL(const TDesC8& aNsUri,
104 const TDesC8& aLocalName,
105 const TDesC8& aQName);
109 * @since Series60 3.0
110 * @param aNsUri is the XML namespace of this fragment
111 * @param aLocalName is the XML localname of this fragment
112 * @param aQName is the qualifiedname of this fragment
113 * @param aAttrs are the XML attributes of this fragment
115 * KErrSenInvalidCharacters if aLocalName or aQName contains
116 * illegal characters.
117 * KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
119 IMPORT_C static CSenDomFragment* NewL(const TDesC8& aNsUri,
120 const TDesC8& aLocalName,
121 const TDesC8& aQName,
122 const RAttributeArray& aAttrs);
126 * @since Series60 3.0
127 * @param aNsUri is the XML namespace of this fragment
128 * @param aLocalName is the XML localname of this fragment
129 * @param aQName is the qualifiedname of this fragment
130 * @param aAttrs are the XML attributes of this fragment
131 * @param aParent is the parent XML element of this fragment
133 * KErrSenInvalidCharacters if aLocalName or aQName contains
134 * illegal characters.
135 * KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
137 IMPORT_C static CSenDomFragment* NewL(const TDesC8& aNsUri,
138 const TDesC8& aLocalName,
139 const TDesC8& aQName,
140 const RAttributeArray& aAttrs,
141 CSenElement& aParent);
146 IMPORT_C virtual ~CSenDomFragment();
151 * Initiates the parsing chain where new delegate will be created with
152 * given parameters and parsing will be delegated to it. Should not be
154 * @since Series60 3.0
155 * @param aNsUri The namespace URI of the new element
156 * @param aLocalName The local name of the new element
157 * @param aQName The qualified name of the new element
158 * @param aAttrs The attributes of the new element
160 IMPORT_C virtual void ExpandL(const TDesC8& aNsUri,
161 const TDesC8& aLocalName,
162 const TDesC8& aQName,
163 const RAttributeArray& aAttrs);
165 // Functions from base classes
167 // From CSenBaseFragment
170 * Resumes the parsing. Usually called by the delegate fragment which was
171 * parsing itself after DelegateParsingL().
172 * @since Series60 3.0
173 * @param aNsUri The namespace URI of the current element
174 * @param aLocalName The local name of the current element
175 * @param aQName The qualified name of the current element
177 IMPORT_C void ResumeParsingFromL(const TDesC8& aNsUri,
178 const TDesC8& aLocalName,
179 const TDesC8& aQName);
182 * Sets the reader for this fragment and sets this to be the
183 * content handler of the following SAX events.
184 * @since Series60 3.0
185 * @param aReader: Reader to be used.
187 IMPORT_C virtual void ParseWithL(CSenXmlReader& aReader);
190 * Sets the attributes for the fragment.
191 * @since Series60 3.0
192 * @param aAttrs the array of attributes.
194 IMPORT_C virtual void SetAttributesL(const RAttributeArray& aAttrs);
199 * C++ default constructor.
201 IMPORT_C CSenDomFragment();
204 * "ConstructL" method for calling the base classes ones.
205 * @since Series60 3.0
206 * @param aElement is the XML element of this fragment.
208 IMPORT_C void BaseConstructL(const CSenElement& aElement);
211 * "ConstructL" method for calling the base classes ones.
212 * @since Series60 3.0
213 * @param aLocalName The local name of the element
215 IMPORT_C void BaseConstructL(const TDesC8& aLocalName);
218 * "ConstructL" method for calling the base classes ones.
219 * @since Series60 3.0
220 * @param aNsUri The namespace URI of the element
221 * @param aLocalName The local name of the element
223 IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
224 const TDesC8& aLocalName);
227 * "ConstructL" method for calling the base classes ones.
228 * @since Series60 3.0
229 * @param aNsUri The namespace URI of the element
230 * @param aLocalName The local name of the element
231 * @param aQName The qualified name of the element
233 IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
234 const TDesC8& aLocalName,
235 const TDesC8& aQName);
238 * "ConstructL" method for calling the base classes ones.
239 * @since Series60 3.0
240 * @param aNsUri The namespace URI of the element
241 * @param aLocalName The local name of the element
242 * @param aQName The qualified name of the element
243 * @param aAttrs The attributes of the element
245 IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
246 const TDesC8& aLocalName,
247 const TDesC8& aQName,
248 const RAttributeArray& aAttrs);
251 * "ConstructL" method for calling the base classes ones.
252 * @since Series60 3.0
253 * @param aNsUri The namespace URI of the element
254 * @param aLocalName The local name of the element
255 * @param aQName The qualified name of the element
256 * @param aAttrs The attributes of the element
257 * @param aParent The parent of the element
259 IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
260 const TDesC8& aLocalName,
261 const TDesC8& aQName,
262 const RAttributeArray& aAttrs,
263 CSenElement& aParent);
266 * "ConstructL" method for calling the base classes ones.
267 * @since Series60 3.0
268 * @param aReader is the XML reader for this fragment.
270 IMPORT_C void BaseConstructL(CSenXmlReader& aReader);
272 // Functions from base classes
275 * Callback functions which implement the XML content handler interface.
276 * Inheriting classes can override these.
279 // From CSenBaseFragment
282 * @since Series60 3.0
283 * @param aNsUri The namespace URI of the element
284 * @param aLocalName The local name of the element
285 * @param aQName The qualified name of the element
286 * @param aAttrs The attributes of the element
288 IMPORT_C virtual void StartElementL(const TDesC8& aNsUri,
289 const TDesC8& aLocalName,
290 const TDesC8& aQName,
291 const RAttributeArray& aAttrs);
294 * Callback functions which implement the XML content handler interface.
295 * This one is called when content is starting.
296 * @since Series60 3.0
297 * @param aChars The content characters.
298 * @param aStart The starting index
299 * @param aLength The length of the characters.
301 IMPORT_C virtual void CharactersL(const TDesC8& aChars,TInt aStart,TInt aLength);
304 * Overriding content writing from CSenBaseFragment to do nothing in
305 * DOM fragment (because the tree is expanded).
306 * @since Series60 3.0
307 * @param aNsUri not used
308 * @param aLocalName not used
309 * @param aQName not used
310 * @param aAttrs not used
312 IMPORT_C void WriteStartElementL(const TDesC8& aNsUri,
313 const TDesC8& aLocalName,
314 const TDesC8& aQName,
315 const RAttributeArray& aAttrs);
318 * Overriding content writing from CSenBaseFragment to do nothing in
319 * DOM fragment (because the tree is expanded).
320 * @since Series60 3.0
321 * @param aNsUri not used
322 * @param aLocalName not used
323 * @param aQName not used
325 IMPORT_C void WriteEndElementL(const TDesC8& aNsUri,
326 const TDesC8& aLocalName,
327 const TDesC8& aQName);
330 CSenDomFragment* ipDomDelegate;
333 #endif //SEN_DOM_FRAGMENT_H