forked from MichaelDrostWago/CodesysProgramGeneration
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestXmlHandling.py
More file actions
19 lines (12 loc) · 776 Bytes
/
testXmlHandling.py
File metadata and controls
19 lines (12 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from datetime import date
import re, time, os
import xml.dom.minidom as dom
f = open("test.xml", "r")
projectTree = dom.parseString(f.read())
print(projectTree.getElementsByTagName('fileHeader')[0].getAttribute('companyName'))
print(projectTree.getElementsByTagName('fileHeader')[0].getAttribute('productName'))
print(projectTree.getElementsByTagName('fileHeader')[0].getAttribute('productVersion'))
print(projectTree.getElementsByTagName('contentHeader')[0].getAttribute('name'))
print(projectTree.getElementsByTagName('contentHeader')[0].getAttribute('modificationDateTime'))
print(projectTree.getElementsByTagName('contentHeader')[0].getAttribute('organization'))
print(projectTree.getElementsByTagName('contentHeader')[0].getAttribute('author'))