/usr/share/pyshared/firmware_addon_dell/HelperXml.py is in firmware-addon-dell 2.2.9-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | # VIM declarations
# vim:tw=0:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:
#############################################################################
#
# Copyright (c) 2003 Dell Computer Corporation
# All Rights Reserved.
#
#############################################################################
from __future__ import generators
import types
def getText(nodelist):
rc = ""
if nodelist is not None:
for node in nodelist:
if node.nodeType == node.TEXT_NODE or node.nodeType == node.CDATA_SECTION_NODE:
rc = rc + node.data
return rc
def getNodeText( node, *args ):
rc = ""
node = getNodeElement(node, *args)
if node is not None:
rc = getText( node.childNodes )
return rc
def getNodeAttribute(node, attrName, *args ):
attribute = None
aNode = getNodeElement(node, *args)
if aNode is not None:
attribute = aNode.getAttribute(attrName)
if attribute == '':
attribute = None
return attribute
def setNodeAttributes(node, attrName, attrValue, *args ):
aNode = getNodeElement(node, *args)
if aNode is not None:
aNode.setAttribute(attrName, attrValue)
return 1
def iterNodeAttribute(node, attrName, *args):
for aNode in iterNodeElement(node, *args):
attribute = aNode.getAttribute(attrName)
if attribute == '':
attribute = None
yield attribute
def iterNodeElement( node, *args ):
if len(args) == 0:
yield node
elif node is not None:
for search in node.childNodes:
if isinstance(args[0], types.StringTypes):
if search.nodeName == args[0]:
for elem in iterNodeElement( search, *args[1:] ):
yield elem
else:
if search.nodeName == args[0][0]:
attrHash = args[0][1]
found = 1
for (key, value) in attrHash.items():
if search.getAttribute( key ) != value:
found = 0
if found:
for elem in iterNodeElement( search, *args[1:] ):
yield elem
def getNodeElement( node, *args ):
if len(args) == 0:
return node
#print "DEBUG: args(%s)" % repr(args)
if node is not None:
for search in node.childNodes:
if isinstance(args[0], types.StringTypes):
if search.nodeName == args[0]:
candidate = getNodeElement( search, *args[1:] )
if candidate is not None:
return candidate
else:
if search.nodeName == args[0][0]:
attrHash = args[0][1]
found = 1
for (key, value) in attrHash.items():
if search.getAttribute( key ) != value:
found = 0
if found:
candidate = getNodeElement( search, *args[1:] )
if candidate is not None:
return candidate
return None
|