-
Notifications
You must be signed in to change notification settings - Fork 2
/
xmlparse.py
69 lines (57 loc) · 1.65 KB
/
xmlparse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
try:
from lxml import etree
print("running with lxml.etree")
except ImportError:
try:
# Python 2.5
import xml.etree.cElementTree as etree
print("running with cElementTree on Python 2.5+")
except ImportError:
try:
# Python 2.5
import xml.etree.ElementTree as etree
print("running with ElementTree on Python 2.5+")
except ImportError:
try:
# normal cElementTree install
import cElementTree as etree
print("running with cElementTree")
except ImportError:
try:
# normal ElementTree install
import elementtree.ElementTree as etree
print("running with ElementTree")
except ImportError:
print("Failed to import ElementTree from any known place, using libxml2")
"""
Steps:
__init__:
self.schema = parse(load(schema))
self.dtd = parse(load(dtd))
self.xml = parse(load(xml))
Load:
urllib / os.path
Validate dtd:
elTree
no dtd, use previous
no previous, simply validate well-formedness
Refresh:
time = 10mins?
if schema:
refresh(schema, time)
if dtd:
refresh(dtd, time)
Autofill:
compare location in path to dtd
show EXPECTED in dropdown
ZencodeXML:
autofill ZencodeXML
"""
class xmlLintUtils():
def __init__(self, xmlFile):
pass
def _refresh(self, file):
pass
def load(self, entity):
# load schema, dtd, etc
pass