graphit/graph_io/io_xml_format.py
def write_xml(graph):
    """
    Export a graph to an XML data format
    
    :param graph:
    :return:
    """
    
    # Graph should be of type GraphAxis with a root node nid defined
    if not isinstance(graph, GraphAxis):
        raise TypeError('Unsupported graph type {0}'.format(type(graph)))
    if graph.root is not None:
        raise GraphitException('No graph root node defines')
    
    # Set current NodeTools aside and register new one
    curr_nt = graph.node_tools
    graph.node_tools = XMLNodeTools
    
    # Define start node for recursive export
    if len(graph) > 1:
        root = graph.getnodes(resolve_root_node(graph))
    else:
        root = graph.getnodes(graph.nid)
    
    # Start recursive parsing
    tree = root.serialize()
    
    # Restore original NodeTools
    graph.node_tools = curr_nt
    
    return et.tostring(tree)

    Export a graph to an XML data format
    
    :param graph:
    :return:
    
Export a graph to an XML data format
Export a graph to an XML data format
def write_xml(graph):
    if not isinstance(graph, GraphAxis):
        raise TypeError('Unsupported graph type {0}'.format(type(graph)))
    if graph.root is not None:
        raise GraphitException('No graph root node defines')
    curr_nt = graph.node_tools
    graph.node_tools = XMLNodeTools
    if len(graph) > 1:
        root = graph.getnodes(resolve_root_node(graph))
    else:
        root = graph.getnodes(graph.nid)
    tree = root.serialize()
    graph.node_tools = curr_nt
    return et.tostring(tree)
def write_xml ( graph ) : if not isinstance ( graph , GraphAxis ) : raise TypeError ( 'Unsupported graph type {0}' . format ( type ( graph ) ) ) if graph . root is not None : raise GraphitException ( 'No graph root node defines' ) curr_nt = graph . node_tools graph . node_tools = XMLNodeTools if len ( graph ) > 1 : root = graph . getnodes ( resolve_root_node ( graph ) ) else : root = graph . getnodes ( graph . nid ) tree = root . serialize ( ) graph . node_tools = curr_nt return et . tostring ( tree )
Export a graph to an XML data format
Export a graph to an XML data format
"""
    Export a graph to an XML data format
    
    :param graph:
    :return:
    """ # Graph should be of type GraphAxis with a root node nid defined # Set current NodeTools aside and register new one # Define start node for recursive export # Start recursive parsing # Restore original NodeTools
None
graph
None