williamr@2
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __CONTENTHANDLER_H__
|
williamr@2
|
17 |
#define __CONTENTHANDLER_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#include <xml/attribute.h> // needed for RAttributeArray
|
williamr@2
|
21 |
|
williamr@2
|
22 |
class RString;
|
williamr@2
|
23 |
|
williamr@2
|
24 |
namespace Xml
|
williamr@2
|
25 |
{
|
williamr@2
|
26 |
|
williamr@2
|
27 |
class RDocumentParameters;
|
williamr@2
|
28 |
class RTagInfo;
|
williamr@2
|
29 |
|
williamr@2
|
30 |
|
williamr@2
|
31 |
class MContentHandler
|
williamr@2
|
32 |
/**
|
williamr@2
|
33 |
This class defines the interface required by a client of the xml framework.
|
williamr@2
|
34 |
It allows a client to be placed in a chain with other clients, i.e. a Parser, a Validator,
|
williamr@2
|
35 |
or a User, and therefore allows the flow of information between these links.
|
williamr@2
|
36 |
It provides callbacks analogous to that of the SAX 2.0 interface.
|
williamr@2
|
37 |
@see http://www.saxproject.org/apidoc/
|
williamr@2
|
38 |
|
williamr@2
|
39 |
@publishedAll
|
williamr@2
|
40 |
@released
|
williamr@2
|
41 |
*/
|
williamr@2
|
42 |
{
|
williamr@2
|
43 |
public:
|
williamr@2
|
44 |
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
This method is a callback to indicate the start of the document.
|
williamr@2
|
47 |
@param aDocParam Specifies the various parameters of the document.
|
williamr@2
|
48 |
@param aDocParam.iCharacterSetName The character encoding of the document.
|
williamr@2
|
49 |
@param aErrorCode is the error code.
|
williamr@2
|
50 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
51 |
*/
|
williamr@2
|
52 |
virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode) = 0;
|
williamr@2
|
53 |
|
williamr@2
|
54 |
|
williamr@2
|
55 |
/**
|
williamr@2
|
56 |
This method is a callback to indicate the end of the document.
|
williamr@2
|
57 |
@param aErrorCode is the error code.
|
williamr@2
|
58 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
59 |
*/
|
williamr@2
|
60 |
virtual void OnEndDocumentL(TInt aErrorCode) = 0;
|
williamr@2
|
61 |
|
williamr@2
|
62 |
|
williamr@2
|
63 |
/**
|
williamr@2
|
64 |
This method is a callback to indicate an element has been parsed.
|
williamr@2
|
65 |
@param aElement is a handle to the element's details.
|
williamr@2
|
66 |
@param aAttributes contains the attributes for the element.
|
williamr@2
|
67 |
@param aErrorCode is the error code.
|
williamr@2
|
68 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
69 |
*/
|
williamr@2
|
70 |
virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes,
|
williamr@2
|
71 |
TInt aErrorCode) = 0;
|
williamr@2
|
72 |
|
williamr@2
|
73 |
|
williamr@2
|
74 |
/**
|
williamr@2
|
75 |
This method is a callback to indicate the end of the element has been reached.
|
williamr@2
|
76 |
@param aElement is a handle to the element's details.
|
williamr@2
|
77 |
@param aErrorCode is the error code.
|
williamr@2
|
78 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
79 |
*/
|
williamr@2
|
80 |
virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) = 0;
|
williamr@2
|
81 |
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/**
|
williamr@2
|
84 |
This method is a callback that sends the content of the element.
|
williamr@2
|
85 |
Not all the content may be returned in one go. The data may be sent in chunks.
|
williamr@2
|
86 |
When an OnEndElementL is received this means there is no more content to be sent.
|
williamr@2
|
87 |
@param aBytes is the raw content data for the element.
|
williamr@2
|
88 |
The client is responsible for converting the data to the
|
williamr@2
|
89 |
required character set if necessary.
|
williamr@2
|
90 |
In some instances the content may be binary and must not be converted.
|
williamr@2
|
91 |
@param aErrorCode is the error code.
|
williamr@2
|
92 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
93 |
*/
|
williamr@2
|
94 |
virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode) = 0;
|
williamr@2
|
95 |
|
williamr@2
|
96 |
|
williamr@2
|
97 |
/**
|
williamr@2
|
98 |
This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping.
|
williamr@2
|
99 |
This method is always called before the corresponding OnStartElementL method.
|
williamr@2
|
100 |
@param aPrefix is the Namespace prefix being declared.
|
williamr@2
|
101 |
@param aUri is the Namespace URI the prefix is mapped to.
|
williamr@2
|
102 |
@param aErrorCode is the error code.
|
williamr@2
|
103 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
104 |
*/
|
williamr@2
|
105 |
virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri,
|
williamr@2
|
106 |
TInt aErrorCode) = 0;
|
williamr@2
|
107 |
|
williamr@2
|
108 |
|
williamr@2
|
109 |
/**
|
williamr@2
|
110 |
This method is a notification of the end of the scope of a prefix-URI mapping.
|
williamr@2
|
111 |
This method is called after the corresponding DoEndElementL method.
|
williamr@2
|
112 |
@param aPrefix is the Namespace prefix that was mapped.
|
williamr@2
|
113 |
@param aErrorCode is the error code.
|
williamr@2
|
114 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
115 |
*/
|
williamr@2
|
116 |
virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode) = 0;
|
williamr@2
|
117 |
|
williamr@2
|
118 |
|
williamr@2
|
119 |
/**
|
williamr@2
|
120 |
This method is a notification of ignorable whitespace in element content.
|
williamr@2
|
121 |
@param aBytes are the ignored bytes from the document being parsed.
|
williamr@2
|
122 |
@param aErrorCode is the error code.
|
williamr@2
|
123 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
124 |
*/
|
williamr@2
|
125 |
virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode) = 0;
|
williamr@2
|
126 |
|
williamr@2
|
127 |
|
williamr@2
|
128 |
/**
|
williamr@2
|
129 |
This method is a notification of a skipped entity. If the parser encounters an
|
williamr@2
|
130 |
external entity it does not need to expand it - it can return the entity as aName
|
williamr@2
|
131 |
for the client to deal with.
|
williamr@2
|
132 |
@param aName is the name of the skipped entity.
|
williamr@2
|
133 |
@param aErrorCode is the error code.
|
williamr@2
|
134 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
135 |
*/
|
williamr@2
|
136 |
virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode) = 0;
|
williamr@2
|
137 |
|
williamr@2
|
138 |
|
williamr@2
|
139 |
/**
|
williamr@2
|
140 |
This method is a receive notification of a processing instruction.
|
williamr@2
|
141 |
@param aTarget is the processing instruction target.
|
williamr@2
|
142 |
@param aData is the processing instruction data. If empty none was supplied.
|
williamr@2
|
143 |
@param aErrorCode is the error code.
|
williamr@2
|
144 |
If this is not KErrNone then special action may be required.
|
williamr@2
|
145 |
*/
|
williamr@2
|
146 |
virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData,
|
williamr@2
|
147 |
TInt aErrorCode) = 0;
|
williamr@2
|
148 |
|
williamr@2
|
149 |
|
williamr@2
|
150 |
/**
|
williamr@2
|
151 |
This method indicates an error has occurred.
|
williamr@2
|
152 |
@param aErrorCode is the error code
|
williamr@2
|
153 |
*/
|
williamr@2
|
154 |
virtual void OnError(TInt aErrorCode) = 0;
|
williamr@2
|
155 |
|
williamr@2
|
156 |
|
williamr@2
|
157 |
/**
|
williamr@2
|
158 |
This method obtains the interface matching the specified uid.
|
williamr@2
|
159 |
@return 0 if no interface matching the uid is found.
|
williamr@2
|
160 |
Otherwise, the this pointer cast to that interface.
|
williamr@2
|
161 |
@param aUid the uid identifying the required interface.
|
williamr@2
|
162 |
*/
|
williamr@2
|
163 |
virtual TAny* GetExtendedInterface(const TInt32 aUid) = 0;
|
williamr@2
|
164 |
|
williamr@2
|
165 |
};
|
williamr@2
|
166 |
|
williamr@2
|
167 |
}
|
williamr@2
|
168 |
|
williamr@2
|
169 |
|
williamr@2
|
170 |
#endif //__CONTENTHANDLER_H__
|