22 |
from Thuban import _ |
from Thuban import _ |
23 |
from Thuban.common import * |
from Thuban.common import * |
24 |
|
|
25 |
|
from Thuban.Model.table import FIELDTYPE_INT, FIELDTYPE_DOUBLE, \ |
26 |
|
FIELDTYPE_STRING |
27 |
|
|
28 |
from Thuban.Model.session import Session |
from Thuban.Model.session import Session |
29 |
from Thuban.Model.map import Map |
from Thuban.Model.map import Map |
30 |
from Thuban.Model.layer import Layer |
from Thuban.Model.layer import Layer |
256 |
end_dispatcher['cldata'] = "end_cldata" |
end_dispatcher['cldata'] = "end_cldata" |
257 |
|
|
258 |
def start_table(self, name, qname, attrs): |
def start_table(self, name, qname, attrs): |
259 |
print "table title: %s" % attrs.get('title', None) |
#print "table title: %s" % attrs.get('title', None) |
260 |
|
pass |
261 |
start_dispatcher['table'] = "start_table" |
start_dispatcher['table'] = "start_table" |
262 |
|
|
263 |
def end_table(self, name, qname): |
def end_table(self, name, qname): |
291 |
parser.setContentHandler(handler) |
parser.setContentHandler(handler) |
292 |
parser.setErrorHandler(ErrorHandler()) |
parser.setErrorHandler(ErrorHandler()) |
293 |
parser.setFeature(xml.sax.handler.feature_namespaces, 1) |
parser.setFeature(xml.sax.handler.feature_namespaces, 1) |
294 |
|
|
295 |
|
# |
296 |
|
# Well, this isn't pretty, but it appears that if you |
297 |
|
# use Python 2.2 without the site-package _xmlplus then |
298 |
|
# the following will fail, and without them it will work. |
299 |
|
# However, if you do have the site-package and you don't |
300 |
|
# call these functions, the reader raises an exception |
301 |
|
# |
302 |
|
try: |
303 |
|
parser.setFeature(xml.sax.handler.feature_validation, 0) |
304 |
|
parser.setFeature(xml.sax.handler.feature_external_ges, 0) |
305 |
|
parser.setFeature(xml.sax.handler.feature_external_pes, 0) |
306 |
|
except SAXNotRecognizedException: |
307 |
|
pass |
308 |
|
|
309 |
parser.parse(file) |
parser.parse(file) |
310 |
|
|
311 |
session = handler.theSession |
session = handler.theSession |