3 |
import sys |
import sys |
4 |
import fraggleError |
import fraggleError |
5 |
|
|
6 |
|
#from fraggleError import * |
7 |
from xml.dom.ext.reader import Sax2 |
from xml.dom.ext.reader import Sax2 |
8 |
from xml.marshal import * |
from xml.marshal import * |
9 |
|
|
24 |
try: |
try: |
25 |
dom = self.reader.fromStream(input) |
dom = self.reader.fromStream(input) |
26 |
except: |
except: |
27 |
fraggleError.errorFileNotFound() |
fraggleError.errorXMLStreamNotValid() |
28 |
return dom |
return dom |
29 |
|
|
30 |
def printXML(self,inputDom,outputLocation): |
def printXML(self,inputDom,outputLocation): |
32 |
file = open(outputLocation,"w") |
file = open(outputLocation,"w") |
33 |
self.reader.PrettyPrint(inputDom,file) |
self.reader.PrettyPrint(inputDom,file) |
34 |
except: |
except: |
35 |
fraggleError.errorFileNotFound() |
fraggleError.errorFileNotFound(outputLocation) |
36 |
|
|
37 |
def marshalXML(self,values,outputLocation): |
def marshalXML(self,values,outputLocation): |
38 |
try: |
try: |
40 |
# self.marshall.dump(values,file) |
# self.marshall.dump(values,file) |
41 |
generic.dump(values,file) |
generic.dump(values,file) |
42 |
except: |
except: |
43 |
fraggleError.errorFileNotFound() |
fraggleError.errorFileNotFound(outputLocation) |
44 |
|
|
45 |
|
|
46 |
#print generic.dumps(values) |
#print generic.dumps(values) |
49 |
try: |
try: |
50 |
file = open(inputLocation,"r") |
file = open(inputLocation,"r") |
51 |
except: |
except: |
52 |
fraggleError.errorFileNotFound() |
return |
53 |
|
#fraggleError.errorFileNotFound(inputLocation) |
54 |
return generic.load(file) |
return generic.load(file) |
55 |
|
|