|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __PARSEHANDLERBASE_H__ |
|
17 #define __PARSEHANDLERBASE_H__ |
|
18 |
|
19 #include <xml/contenthandler.h> |
|
20 #include <xml/contentsource.h> |
|
21 #include <xml/parserfeature.h> |
|
22 #include <e32base.h> |
|
23 |
|
24 using namespace Xml; |
|
25 |
|
26 /** Provides an MContentHandler inteface that has a virtual destructor and implements |
|
27 default behavior for parsers which can be overriden by derived parsers as required |
|
28 */ |
|
29 class CParseHandlerBase : public CBase, public MContentHandler |
|
30 { |
|
31 public: |
|
32 virtual ~CParseHandlerBase(); |
|
33 |
|
34 // Overridden as required by derived classes |
|
35 inline virtual void ParseStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes); |
|
36 inline virtual void ParseEndElementL(const RTagInfo& aElement); |
|
37 inline virtual void ParseContentL(const TDesC8& aBytes); |
|
38 inline virtual void ParsePrefixL(const RString& aPrefix, const RString& aUri); |
|
39 |
|
40 // From MContentHandler |
|
41 inline virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); |
|
42 inline virtual void OnEndDocumentL(TInt aErrorCode); |
|
43 virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); |
|
44 virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); |
|
45 virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode); |
|
46 virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); |
|
47 inline virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); |
|
48 inline virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); |
|
49 inline virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode); |
|
50 inline virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); |
|
51 inline virtual void OnError(TInt aErrorCode); |
|
52 inline virtual TAny* GetExtendedInterface(const TInt32 aUid); |
|
53 TBool IsBlankSpace(const TDesC8& aBytes); |
|
54 protected: |
|
55 void StartChildParserL(CParseHandlerBase* aChildParser, const RTagInfo& aElement, const RAttributeArray& aAttributes); |
|
56 |
|
57 private: |
|
58 inline TInt SiblingCount(); |
|
59 |
|
60 private: |
|
61 CParseHandlerBase* iChildParser; // delete when depth = 0 |
|
62 protected: |
|
63 TInt iSiblingsCount; |
|
64 RString iString; |
|
65 }; |
|
66 |
|
67 TInt CParseHandlerBase::SiblingCount() |
|
68 { |
|
69 return iSiblingsCount; |
|
70 } |
|
71 |
|
72 #include "parsehandlerbase.inl" |
|
73 #endif |