#NEWLINE# def asXml( self ) : #NEWLINE# #INDENT# line = self . getSourceReference ( ) . getLineNumber ( ) #NEWLINE# result = TreeXML . Element ( 'node' , kind = self . __class__ . __name__ , line = ( '%s' % line ) ) #NEWLINE# compat_line = self . getCompatibleSourceReference ( ) . getLineNumber ( ) #NEWLINE# if ( compat_line != line ) : #NEWLINE# #INDENT# result . attrib [ 'compat_line' ] = str ( compat_line ) #NEWLINE# #UNINDENT# for ( key , value ) in iterItems ( self . getDetailsForDisplay ( ) ) : #NEWLINE# #INDENT# value = str ( value ) #NEWLINE# if ( value . startswith ( '<' ) and value . endswith ( '>' ) ) : #NEWLINE# #INDENT# value = value [ 1 : ( - 1 ) ] #NEWLINE# #UNINDENT# result . set ( key , str ( value ) ) #NEWLINE# #UNINDENT# for ( name , children ) in self . getVisitableNodesNamed ( ) : #NEWLINE# #INDENT# role = TreeXML . Element ( 'role' , name = name ) #NEWLINE# if ( type ( children ) not in ( list , tuple ) ) : #NEWLINE# #INDENT# children = ( children , ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# role . attrib [ 'type' ] = 'list' #NEWLINE# #UNINDENT# result . append ( role ) #NEWLINE# for child in children : #NEWLINE# #INDENT# if ( child is not None ) : #NEWLINE# #INDENT# role . append ( child . asXml ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return result