#NEWLINE# def get_lazy_node( self , path = '' , add_ns = True ) : #NEWLINE# #INDENT# '\n        Returns yang explorer compatible lazy node xml. A lazy\n        node only returns a cxml node which is requested. All\n        other node along the path returned as _placeholder_\n        nodes for on-demand loading in client tree.\n        ' #NEWLINE# logging . debug ( ( 'get_lazy_node: ' + path ) ) #NEWLINE# root = ET . Element ( 'root' ) #NEWLINE# if ( self . cxml is None ) : #NEWLINE# #INDENT# return root #NEWLINE# #UNINDENT# cxml_root = self . cxml . getroot ( ) #NEWLINE# if ( path == '' ) : #NEWLINE# #INDENT# node = self . get_lazy_node_internal ( cxml_root ) #NEWLINE# nslist = [ ( ( c . get ( 'prefix' ) + ',' ) + c . text ) for c in cxml_root if ( c . tag == 'namespace' ) ] #NEWLINE# node . set ( 'namespaces' , '|' . join ( nslist ) ) #NEWLINE# node . set ( 'name' , self . modulename ) #NEWLINE# root . append ( node ) #NEWLINE# return root #NEWLINE# #UNINDENT# elements = path . split ( '/' ) #NEWLINE# for name in elements [ 1 : ] : #NEWLINE# #INDENT# for child in cxml_root : #NEWLINE# #INDENT# if ( child . get ( 'name' , '' ) == name ) : #NEWLINE# #INDENT# cxml_root = child #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for child in cxml_root : #NEWLINE# #INDENT# if ( child . tag == 'node' ) : #NEWLINE# #INDENT# node = self . get_lazy_node_internal ( child , path ) #NEWLINE# root . append ( node ) #NEWLINE# #UNINDENT# if ( ( root . tag == 'namespace' ) and add_ns ) : #NEWLINE# #INDENT# if ( cxml_root . get ( 'prefix' , '' ) == child . get ( 'prefix' ) ) : #NEWLINE# #INDENT# child . set ( 'default' , 'true' ) #NEWLINE# #UNINDENT# root . append ( child ) #NEWLINE# #UNINDENT# #UNINDENT# return root