17 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
18 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
19 |
# |
# |
20 |
# Copyright 2001 Free Software Foundation |
# Copyright 2001-2003 Free Software Foundation |
21 |
# |
# |
22 |
# FILE: |
# FILE: |
23 |
# mailmerge.py |
# mailmerge.py |
30 |
# |
# |
31 |
|
|
32 |
import string, sys, re |
import string, sys, re |
33 |
from xml.sax import saxlib, saxexts |
import xml.sax |
34 |
|
|
35 |
class MergeBase(saxlib.HandlerBase): |
class MergeBase(xml.sax.ContentHandler): |
36 |
FIELD_ENCLOSURE = '::' |
FIELD_ENCLOSURE = '::' |
37 |
NEWPAGE = "\p" |
NEWPAGE = "\p" |
38 |
HEAD_DELIMITER = r"^" |
HEAD_DELIMITER = r"^" |
91 |
"GNUe MailMerge [%s]: Start of Repeating Section"%self.NAME) |
"GNUe MailMerge [%s]: Start of Repeating Section"%self.NAME) |
92 |
|
|
93 |
# Create a parser |
# Create a parser |
94 |
parser = saxexts.make_parser() |
parser = xml.sax.make_parser() |
95 |
|
|
96 |
# Tell the parser to use our handler |
# Tell the parser to use our handler |
97 |
parser.setDocumentHandler(self) |
parser.setContentHandler(self) |
98 |
parser.parseFile(data) |
parser.parse(data) |
|
parser.close() |
|
99 |
|
|
100 |
|
|
101 |
# Print out the footer text |
# Print out the footer text |
114 |
self.output.write(self.NEWRECORD) |
self.output.write(self.NEWRECORD) |
115 |
self.newPage = 1 |
self.newPage = 1 |
116 |
|
|
117 |
def characters(self, ch, start, length): |
def characters(self, ch): |
118 |
pass |
pass |
119 |
|
|
120 |
def endElement(self, name): |
def endElement(self, name): |