This function returns the text content of a node's child.
# - - - g e t C h i l d C o n t e n t
def getChildContent ( node, childName ):
"""Get the text from a child node.
[ (node is an et.Element) and
(childName is a string) ->
if node has any children named childName ->
return the concatenation of the first such child
node's direct text content
else -> return "" ]
"""
childList = node.xpath ( childName )
if len(childList) == 0:
return ""
else:
return textContent ( childList[0] )