-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathxmlfilewrite.py
75 lines (67 loc) · 1.83 KB
/
xmlfilewrite.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
70
71
72
73
74
75
# vim:sw=8:ts=8:nowrap
def WriteXMLHeader(fout):
header = '<?xml version="1.0" encoding="UTF-8"?>\n'
fout.write(header)
# These entity definitions for latin-1 chars are from here:
# http://www.w3.org/TR/REC-html40/sgml/entities.html
# also available at: http://www.csparks.com/CharacterEntities.html
entities = """
<!DOCTYPE publicwhip
[
<!ENTITY ndash "–">
<!ENTITY mdash "—">
<!ENTITY iexcl "¡">
<!ENTITY divide "÷">
<!ENTITY euro "€">
<!ENTITY trade "™">
<!ENTITY bull "•">
<!ENTITY lsquo "‘">
<!ENTITY rsquo "’">
<!ENTITY sbquo "‚">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY bdquo "„">
<!ENTITY dagger "†">
<!ENTITY Ouml "Ö" >
<!ENTITY szlig "ß" >
<!ENTITY agrave "à" >
<!ENTITY aacute "á" >
<!ENTITY acirc "â" >
<!ENTITY atilde "ã" >
<!ENTITY auml "ä" >
<!ENTITY ccedil "ç" >
<!ENTITY egrave "è" >
<!ENTITY eacute "é" >
<!ENTITY ecirc "ê" >
<!ENTITY euml "ë" >
<!ENTITY iacute "í" >
<!ENTITY icirc "î" >
<!ENTITY iuml "ï" >
<!ENTITY ntilde "ñ" >
<!ENTITY nbsp " " >
<!ENTITY oacute "ó" >
<!ENTITY ocirc "ô" >
<!ENTITY ouml "ö" >
<!ENTITY oslash "ø" >
<!ENTITY uacute "ú" >
<!ENTITY uuml "ü" >
<!ENTITY thorn "þ" >
<!ENTITY pound "£" >
<!ENTITY sect "§" >
<!ENTITY copy "©" >
<!ENTITY reg "®" >
<!ENTITY deg "°" >
<!ENTITY plusmn "±" >
<!ENTITY sup2 "²" >
<!ENTITY micro "µ" >
<!ENTITY para "¶" >
<!ENTITY middot "·" >
<!ENTITY ordm "º" >
<!ENTITY frac14 "¼" >
<!ENTITY frac12 "½" >
<!ENTITY frac34 "¾" >
<!ENTITY oelig "œ" >
<!ENTITY aelig "æ" >
]>
"""
fout.write(entities)