Package ndg :: Package saml :: Package xml :: Module etree :: Class _PrettyPrint
[hide private]

Class _PrettyPrint

source code


Class for lightweight pretty printing of ElementTree elements

Instance Methods [hide private]
 
__init__(self, declaredNss, mappedPrefixes)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
basestring
__call__(self, elem, indent='', html=0, space=' ')
Most of the work done in this wrapped function - wrapped so that state can be maintained for declared namespace declarations during recursive calls using "declaredNss" above
source code
 
_getNamespacePrefix(self, elem, namespace) source code
 
_allocNsPrefix(self, nsURI)
Allocate a namespace prefix if one is not already set for the given Namespace URI
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
basestring
estrip(elem)
Utility to remove unwanted leading and trailing whitespace
source code
Class Variables [hide private]
  MAX_NS_TRIES = 256
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, declaredNss, mappedPrefixes)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • declaredNss (iterable of string elements) - declared namespaces
  • mappedPrefixes (map of string to string) - map of namespace URIs to prefixes
Overrides: object.__init__

estrip(elem)
Static Method

source code 

Utility to remove unwanted leading and trailing whitespace

Parameters:
  • elem (ElementTree.Element) - ElementTree element
Returns: basestring
element content with whitespace removed

__call__(self, elem, indent='', html=0, space=' ')
(Call operator)

source code 

Most of the work done in this wrapped function - wrapped so that state can be maintained for declared namespace declarations during recursive calls using "declaredNss" above

Parameters:
  • elem (ElementTree.Element) - ElementTree element
  • indent (basestring) - set indent for output
  • space (basestring) - set output spacing
Returns: basestring
pretty print format for doc