Maybe solved the PyXML/python1/2 problem?

svn: r192
This commit is contained in:
Don Allingham 2001-06-28 15:23:16 +00:00
parent f3617ec650
commit f64eee94ed
2 changed files with 16 additions and 48 deletions

View File

@ -31,18 +31,15 @@ import sys
#
#-------------------------------------------------------------------------
if sys.version[0] != '1':
sax = 2
try:
from _xmlplus.sax import handler
from _xmlplus.sax import make_parser
except:
from xml.sax import handler
from xml.sax import make_parser
else:
try:
from xml.sax import handler
import xml.sax.saxexts
sax = 1
except:
sax = 2
from xml.sax import make_parser
#-------------------------------------------------------------------------
#
@ -858,11 +855,6 @@ class GrampsParser(handler.ContentHandler):
self.func_index = self.func_index - 1
self.func,self.data = self.func_list[self.func_index]
if sax == 1:
def characters(self, data, offset, length):
if self.func:
self.data = self.data + data
else:
def characters(self, data):
if self.func:
self.data = self.data + data

View File

@ -28,24 +28,10 @@ import utils
# Try to abstract SAX1 from SAX2
#
#-------------------------------------------------------------------------
if sys.version[0] != '1':
sax = 2
try:
from _xmlplus.sax import make_parser
from _xmlplus.sax import handler
except:
from xml.sax import make_parser
from xml.sax import handler
else:
try:
import xml.sax.saxexts
from xml.sax.saxutils import ErrorRaiser
from xml.sax import handler
sax = 1
except:
from xml.sax.saxutils import ErrorRaiser
from xml.sax import handler
sax = 2
try:
from xml.sax import make_parser,handler
except:
from _xmlplus.sax import make_parser,handler
FONT_SANS_SERIF = 0
FONT_SERIF = 1
@ -473,12 +459,6 @@ class StyleSheetList:
except:
return
if sax == 1:
parser = make_parser()
parser.setDocumentHandler(SheetParser(self))
parser.setErrorHandler(ErrorRaiser())
parser.parseFile(f)
else:
parser = make_parser()
parser.setContentHandler(SheetParser(self))
parser.parse(f)
@ -566,10 +546,6 @@ class SheetParser(handler.ContentHandler):
elif tag == "sheet":
self.sheetlist.set_style_sheet(self.sname,self.s)
if sax == 1:
def characters(self, data, offset, length):
pass
else:
def characters(self, data):
pass