Linux premium71.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
LiteSpeed
Server IP : 198.187.29.8 & Your IP : 18.188.13.212
Domains :
Cant Read [ /etc/named.conf ]
User : cleahvkv
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib64 /
python2.7 /
Demo /
xml /
Delete
Unzip
Name
Size
Permission
Date
Action
elem_count.py
1.14
KB
-rw-r--r--
2020-04-19 21:13
elem_count.pyc
1.79
KB
-rw-r--r--
2024-04-10 04:58
elem_count.pyo
1.79
KB
-rw-r--r--
2024-04-10 04:58
roundtrip.py
1.2
KB
-rw-r--r--
2020-04-19 21:13
roundtrip.pyc
2.31
KB
-rw-r--r--
2024-04-10 04:58
roundtrip.pyo
2.31
KB
-rw-r--r--
2024-04-10 04:58
rss2html.py
2.27
KB
-rw-r--r--
2020-04-19 21:13
rss2html.pyc
2.63
KB
-rw-r--r--
2024-04-10 04:58
rss2html.pyo
2.63
KB
-rw-r--r--
2024-04-10 04:58
Save
Rename
""" A simple demo that reads in an XML document and displays the number of elements and attributes as well as a tally of elements and attributes by name. """ import sys from collections import defaultdict from xml.sax import make_parser, handler class FancyCounter(handler.ContentHandler): def __init__(self): self._elems = 0 self._attrs = 0 self._elem_types = defaultdict(int) self._attr_types = defaultdict(int) def startElement(self, name, attrs): self._elems += 1 self._attrs += len(attrs) self._elem_types[name] += 1 for name in attrs.keys(): self._attr_types[name] += 1 def endDocument(self): print "There were", self._elems, "elements." print "There were", self._attrs, "attributes." print "---ELEMENT TYPES" for pair in self._elem_types.items(): print "%20s %d" % pair print "---ATTRIBUTE TYPES" for pair in self._attr_types.items(): print "%20s %d" % pair if __name__ == '__main__': parser = make_parser() parser.setContentHandler(FancyCounter()) parser.parse(sys.argv[1])