-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpowerdesigner.py
38 lines (30 loc) · 943 Bytes
/
powerdesigner.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
import xml.dom
from xml.dom import minidom
import xml.etree.ElementTree as ET
import powerdesigner
def getFID(headerstr):
_fid = ""
idbegin = headerstr.find('ID=') + 5
print(idbegin)
while(headerstr[idbegin] != '}'):
_fid += headerstr[idbegin]
idbegin += 1
print(_fid)
return _fid
def getTID(headerstr):
_tid = ""
idbegin = headerstr.find('Type=') + 7
print(idbegin)
while(headerstr[idbegin] != '}'):
_tid += headerstr[idbegin]
idbegin += 1
print(_tid)
return _tid
def makeSWS(data, wsname):
staticInserts = ['<?xml version="1.0" encoding="UTF-8"?>\n','<?PowerDesigner signature="Workspace" version="16.6.6.5645"?>\n','<!-- do not edit this file -->\n']
mydata = ET.tostring(data)
writedata = str(mydata)
myfile = open(wsname, "w")
myfile.writelines(staticInserts)
myfile.write("\n")
myfile.write(writedata[2:len(writedata)-1])