|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This utility class provides static methods for searching |
|
15 * StartTag and EndTag of certain element from XML Document. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 #ifndef SEN_SAX_UTILS_H |
|
27 #define SEN_SAX_UTILS_H |
|
28 |
|
29 // INCLUDES |
|
30 #include <e32base.h> |
|
31 |
|
32 // CONSTANTS |
|
33 const TInt KSenMaxLengthSaxParsingSoapMsg = 10000; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * This utility class provides static methods for searching |
|
39 * StartTag and EndTag from XML Document. |
|
40 * @lib SenUtils.lib |
|
41 * @since Series60 4.0 |
|
42 */ |
|
43 class SenSaxUtils |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Search StartTag from XML Document. |
|
48 * Searching starts from the beginning of the given document. |
|
49 * |
|
50 * @since Series60 4.0 |
|
51 * @param aDocument XML Document from which StartTag is |
|
52 * searched. |
|
53 * @param aLocalName LocalName of StartTag to be searched. |
|
54 * @param aStartTagStart Reference to TInt which will contain |
|
55 * value telling starting position of |
|
56 * searched StartTag. |
|
57 * @param aStartTagEnd Reference to TInt which will contain |
|
58 * value telling ending position of |
|
59 * searched StartTag. |
|
60 * @param aPrefix Reference to TPtrC8 for which pointer |
|
61 * of the Prefix of StartTag will be |
|
62 * stored. |
|
63 * Note: aPrefix points to given |
|
64 * aDocument descriptor. |
|
65 * @return KErrNone if StartTag were found. |
|
66 * KErrNotFound if StartTag were not found. |
|
67 */ |
|
68 IMPORT_C static TInt SearchStartTagL(const TDesC8& aDocument, |
|
69 const TDesC8& aLocalName, |
|
70 TInt& aStartTagStart, |
|
71 TInt& aStartTagEnd, |
|
72 TPtrC8& aPrefix); |
|
73 |
|
74 /** |
|
75 * Search StartTag from XML Document. |
|
76 * Searching starts from the beginning of the given document. |
|
77 * |
|
78 * @since Series60 4.0 |
|
79 * @param aDocument Document from which StartTag is searched |
|
80 * @param aPrefix Prefix of StartTag to be searched. |
|
81 * @param aLocalName LocalName of StartTag to be searched. |
|
82 * @param aStartTagStart Reference to TInt which will contain |
|
83 * value telling starting position of |
|
84 * searched StartTag. |
|
85 * @param aStartTagEnd Reference to TInt which will contain |
|
86 * value telling ending position of |
|
87 * searched StartTag. |
|
88 * @return KErrNone if StartTag were found. |
|
89 * KErrNotFound if StartTag were not found. |
|
90 */ |
|
91 IMPORT_C static TInt SearchStartTagL(const TDesC8& aDocument, |
|
92 const TDesC8& aPrefix, |
|
93 const TDesC8& aLocalName, |
|
94 TInt& aStartTagStart, |
|
95 TInt& aStartTagEnd); |
|
96 |
|
97 /** |
|
98 * Search EndTag from XML Document. |
|
99 * Searching starts from the end of the given document. |
|
100 * |
|
101 * @since Series60 4.0 |
|
102 * @param aDocument XML Document from which EndTag is |
|
103 * searched. |
|
104 * @param aLocalName LocalName of EndTag to be searched. |
|
105 * @param aEndTagStart Reference to TInt which will contain |
|
106 * value telling ending position of |
|
107 * searched EndTag. |
|
108 * @param aEndTagEnd Reference to TInt which will contain |
|
109 * value telling ending position of |
|
110 * searched EndTag. |
|
111 * @param aPrefix Reference to TPtrC8 for which pointer |
|
112 * of the Prefix of EndTag will be |
|
113 * stored. |
|
114 * Note: aPrefix points to given |
|
115 * aDocument descriptor. |
|
116 * @return KErrNone if EndTag were found. |
|
117 * KErrNotFound if EndTag were not found. |
|
118 */ |
|
119 IMPORT_C static TInt SearchEndTagL(const TDesC8& aDocument, |
|
120 const TDesC8& aLocalName, |
|
121 TInt& aEndTagStart, |
|
122 TInt& aEndTagEnd, |
|
123 TPtrC8& aPrefix); |
|
124 |
|
125 /** |
|
126 * Search EndTag from XML Document. |
|
127 * Searching starts from the end of the given document. |
|
128 * |
|
129 * @since Series60 4.0 |
|
130 * @param aDocument Document from which EndTag is searched |
|
131 * @param aPrefix Prefix of EndTag to be searched. |
|
132 * @param aLocalName LocalName of EndTag to be searched. |
|
133 * @param aEndTagStart Reference to TInt which will contain |
|
134 * value telling starting position of |
|
135 * searched EndTag. |
|
136 * @param aEndTagEnd Reference to TInt which will contain |
|
137 * value telling ending position of |
|
138 * searched EndTag. |
|
139 * @return KErrNone if EndTag were found. |
|
140 * KErrNotFound if EndTag were not found. |
|
141 */ |
|
142 IMPORT_C static TInt SearchEndTagL(const TDesC8& aDocument, |
|
143 const TDesC8& aPrefix, |
|
144 const TDesC8& aLocalName, |
|
145 TInt& aEndTagStart, |
|
146 TInt& aEndTagEnd); |
|
147 |
|
148 |
|
149 private: |
|
150 static TInt SearchStartTagL(const TDesC8& aDocument, |
|
151 const TDesC8& aLocalName, |
|
152 TInt& aStartTagStart, |
|
153 TInt& aStartTagEnd, |
|
154 TPtrC8& aPrefix, |
|
155 TBool aSearchPrefix); |
|
156 |
|
157 static TInt SearchEndTagL(const TDesC8& aDocument, |
|
158 const TDesC8& aLocalName, |
|
159 TInt& aEndTagStart, |
|
160 TInt& aEndTagEnd, |
|
161 TPtrC8& aPrefix, |
|
162 TBool aSearchPrefix); |
|
163 |
|
164 static TInt SearchMarkStartingFromPlus(const TDesC8& aDocument, |
|
165 const TDesC8& aMark, |
|
166 TInt position, |
|
167 TInt size); |
|
168 |
|
169 static TInt SearchMarkStartingFromMinus(const TDesC8& aDocument, |
|
170 const TDesC8& aMark, |
|
171 TInt position); |
|
172 |
|
173 static TInt SearchMatchingGreaterThanStartingFrom(const TDesC8& aDocument, |
|
174 TInt position, |
|
175 TInt size); |
|
176 |
|
177 static TInt SearchEndOfCommentStartingFrom(const TDesC8& aDocument, |
|
178 TInt position, |
|
179 TInt size); |
|
180 |
|
181 static TInt SearchStartOfCommentStartingFrom(const TDesC8& aDocument, |
|
182 TInt position); |
|
183 |
|
184 /** |
|
185 * Hide default C++ constructor. |
|
186 */ |
|
187 SenSaxUtils() { } |
|
188 |
|
189 /** |
|
190 * Prohibit copy constructor if not deriving from CBase. |
|
191 */ |
|
192 SenSaxUtils( const SenSaxUtils& ); |
|
193 |
|
194 /** |
|
195 * Prohibit assignment operator if not deriving from CBase. |
|
196 */ |
|
197 SenSaxUtils& operator=( const SenSaxUtils& ); |
|
198 }; |
|
199 |
|
200 #endif // SEN_SAX_UTILS_H |
|
201 |
|
202 // End of File |