Package src :: Package inspectors :: Module common_methods
[hide private]
[frames] | no frames]

Module common_methods

source code

The module contains common methods to access DOM tree.


Author: Vili Auvinen, Olli Kauppinen, Juho Tammela

Functions [hide private]
 
getTextContent(element)
Returns recursively all the text content from the given element.
source code
 
getAttributeContent(element)
Return recursively all the attribute's content from the given element and it's children.
source code
 
checkStringFromContent(element, wantedString)
Check if given element contains given string.
source code
 
checkIfEmailAddress(element)
Checks if the element contains an e-mail address.
source code
 
getDescendants(element, elementList)
Gets elements all descendants.
source code
 
checkParentNode(element, parentTag)
Checks if the element have the given parentTag as parent
source code
Variables [hide private]
  __package__ = None
Function Details [hide private]

getTextContent(element)

source code 

Returns recursively all the text content from the given element. The function can be used both in, odt_inspector and docx_inspector modules.

Parameters:
  • element - the element to be checked.
Returns:
All text content from its element and descendants.

getAttributeContent(element)

source code 

Return recursively all the attribute's content from the given element and it's children. The function can be used both in, odt_inspector and docx_inspector modules.

Parameters:
  • element - the element to be checked.
Returns:
All attribute's content from element and descendants.

checkStringFromContent(element, wantedString)

source code 

Check if given element contains given string. Encode to utf-8.

Returns:
True if the element contains given string, False if not.

checkIfEmailAddress(element)

source code 

Checks if the element contains an e-mail address. @-char is identifier.

Returns:
An e-mail address, None if the element contains no e-mail.

getDescendants(element, elementList)

source code 

Gets elements all descendants.

Parameters:
  • element - is the node whose descendants are returned.
  • elementList - is an empty list when function have called from outside. There is elements in list when function calls itself.
Returns:
The list of all descendants of the specified element.

checkParentNode(element, parentTag)

source code 

Checks if the element have the given parentTag as parent

Parameters:
  • element - is the element to be checked
  • parentTag - is the tag which the returned parents have.
Returns:
True if the given element have parentTag as parent