591
|
1 |
#
|
|
2 |
# Copyright (c) 2010 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 the License "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:
|
|
15 |
# Example of a Filter class using the SAX parser base class
|
|
16 |
#
|
|
17 |
|
|
18 |
import filter_interface
|
|
19 |
|
|
20 |
class FilterBroken(filter_interface.FilterSAX):
|
|
21 |
|
|
22 |
def startDocument(self):
|
|
23 |
self.first = True
|
|
24 |
|
|
25 |
def startElement(self, name, attributes):
|
|
26 |
pass
|
|
27 |
|
|
28 |
def characters(self, char):
|
|
29 |
pass
|
|
30 |
|
|
31 |
def endElement(self, name):
|
|
32 |
pass
|
|
33 |
|
|
34 |
def endDocument(self):
|
|
35 |
pass
|
|
36 |
|
|
37 |
def error(self, exception):
|
|
38 |
pass
|
|
39 |
|
|
40 |
def fatalError(self, exception):
|
|
41 |
if self.first:
|
|
42 |
print "fatal error:", str(exception)
|
|
43 |
self.first = False
|
|
44 |
|
|
45 |
def warning(self, exception):
|
|
46 |
pass
|
|
47 |
|
|
48 |
# the end
|