|
1 // Copyright (c) 2003-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 CONTENTHANDLERS_H |
|
17 #define CONTENTHANDLERS_H |
|
18 |
|
19 #include <xml/contenthandler.h> |
|
20 |
|
21 class RFile; |
|
22 |
|
23 namespace Xml |
|
24 { |
|
25 |
|
26 class TRebuildingContentHandler : public MContentHandler |
|
27 { |
|
28 public: |
|
29 |
|
30 TRebuildingContentHandler(RFile& aOut); |
|
31 |
|
32 // From MContentHandler |
|
33 void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); |
|
34 void OnEndDocumentL(TInt aErrorCode); |
|
35 void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); |
|
36 void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); |
|
37 void OnContentL(const TDesC8& aBytes, TInt aErrorCode); |
|
38 void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); |
|
39 void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); |
|
40 void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); |
|
41 void OnSkippedEntityL(const RString& aName, TInt aErrorCode) ; |
|
42 void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); |
|
43 void OnExtensionL(const RString& aData, TInt aToken, TInt aErrorCode); |
|
44 void OnError(TInt aErrorCode); |
|
45 TAny* GetExtendedInterface(const TInt32 aUid); |
|
46 |
|
47 public: |
|
48 TInt iError; |
|
49 |
|
50 private: |
|
51 RFile& iOutFile; |
|
52 }; |
|
53 |
|
54 class TSimpleContentHandler : public MContentHandler |
|
55 { |
|
56 public: |
|
57 TSimpleContentHandler(); |
|
58 |
|
59 // From MContentHandler |
|
60 void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); |
|
61 void OnEndDocumentL(TInt aErrorCode); |
|
62 void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); |
|
63 void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); |
|
64 void OnContentL(const TDesC8& aBytes, TInt aErrorCode); |
|
65 void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); |
|
66 void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); |
|
67 void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); |
|
68 void OnSkippedEntityL(const RString& aName, TInt aErrorCode) ; |
|
69 void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); |
|
70 void OnExtensionL(const RString& aData, TInt aToken, TInt aErrorCode); |
|
71 void OnOutOfData(); |
|
72 void OnError(TInt aErrorCode); |
|
73 TAny* GetExtendedInterface(const TInt32 aUid); |
|
74 |
|
75 public: |
|
76 static const TInt KExpectedLeaveCode; |
|
77 |
|
78 public: |
|
79 TBool iLeaveOnStartElement; |
|
80 TInt iNumElements; |
|
81 TInt iNumSkippedEntities; |
|
82 TInt iNumPrefixMappings; |
|
83 TInt iNumPrefixUnmappings; |
|
84 TInt iError; |
|
85 }; |
|
86 |
|
87 class TNamespaceContentHandler : public TSimpleContentHandler |
|
88 { |
|
89 public: |
|
90 TNamespaceContentHandler(const TDesC8& aDefaultUri, const TDesC8& aElementPrefix, const TDesC8& aElementUri, |
|
91 const TDesC8& aAttributePrefix, const TDesC8& aAttributeUri); |
|
92 |
|
93 // From MContentHandler |
|
94 void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); |
|
95 void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); |
|
96 void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); |
|
97 void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); |
|
98 |
|
99 private: |
|
100 const TDesC8& iDefaultUri; |
|
101 const TDesC8& iElementPrefix; |
|
102 const TDesC8& iElementUri; |
|
103 const TDesC8& iAttributePrefix; |
|
104 const TDesC8& iAttributeUri; |
|
105 enum { KNothingMapped, KDefaultNsMapped, KElementNsMapped, KAttributeNsMapped } iState; |
|
106 }; |
|
107 |
|
108 class TCapsContentHandler : public TSimpleContentHandler |
|
109 { |
|
110 public: |
|
111 // From MContentHandler |
|
112 void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); |
|
113 }; |
|
114 } |
|
115 |
|
116 #endif // CONTENTHANDLERS_H |