---
name: "GO::IO::OBDXML"
section: "3pm"
platform: "linux"
package: "libgo-perl"
version: "0.15-10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/GO::IO::OBDXML"
---

# GO::IO::OBDXML(3pm)

## NAME

```
  GO::IO::OBDXML - dump GO terms as xml
```

## SYNOPSIS

```
    my $apph = GO::AppHandle->connect(-d=>$go, -dbhost=>$dbhost);
    my $term = $apph->get_term({acc=>00003677});
    #### ">-" is STDOUT
    my $out = new FileHandle(">-");
    my $xml_out = GO::IO::OBDXML->new(-output=>$out);
    $xml_out->start_document();
    $xml_out->draw_term($term);
    $xml_out->end_document();
```

OR:

```
    my $apph = GO::AppHandle->connect(-d=>$go, -dbhost=>$dbhost);
    my $term = $apph->get_node_graph(-acc=>00003677, -depth=>2);
    my $out = new FileHandle(">-");
    my $xml_out = GO::IO::OBDXML(-output=>$out);
    $xml_out->start_document();
    $xml_out->draw_graph($term, 3677);
    $xml_out->end_document();
```

## DESCRIPTION

Utility class to dump GO terms as OBD XML.  Currently you just call start\_ducument, then draw\_term for each term, then end\_document.

### new

```
    Usage   - my $xml_out = GO::IO::OBDXML->new(-output=>$out);
    Returns - None
    Args    - Output FileHandle
```

Initializes the writer object.  To write to standard out, do:

my `$out` = new FileHandle("\>-"); my `$xml_out` = new GO::IO::OBDXML(-output=\>$out);

### cgi\_header

```
    Usage   - $xml_out->cgi_header;
    Returns - None
    Args    - None
```

cgi\_header prints the "Content-type: text/xml" statement. If creating a CGI script, you should call this before start\_document.

### start\_document

```
    Usage   - $xml_out->start_document;
    Returns - None
    Args    - None
```

start\_document takes care of the fiddly bits like xml declarations, namespaces, etc.  It draws the initial tags and leaves the document ready to add go:term nodes.

### start\_graph

```
    Usage   - $xml_out->start_graph;
    Returns - None
    Args    - None
```

start\_graph opens a new graph segment.

### end\_document

```
    Usage   - $xml_out->end_document;
```

Call this when done.

### end\_graph

```
    Usage   - $xml_out->end_graph;
```

Call this when done a graph segment.

### draw\_node\_graph

```
    Usage   - $xml_out->draw_node_graph(-graph=>$graph);
    Returns - None
    Args    -graph=>$graph,
            -show_associations=>'yes' or 'no', # optional, default 'yes'.
            -show_terms=>'yes' or 'no',        # optional, default 'yes'.
            -show_xrefs=>'yes' or 'no',        # optional, default 'yes'.
            -show_evidence=>'yes' or 'no',     # optional, default 'yes'.
```

### draw\_term

```
    Usage   - $xml_out->draw_term();
    Returns - None
    Args    -term=>$term,
            -graph=>$graph,                    # optional
            -show_associations=>'yes' or 'no', # optional, default 'yes'.
            -show_terms=>'yes' or 'no',        # optional, default 'yes'.
            -show_xrefs=>'yes' or 'no',        # optional, default 'yes'.
            -show_evidence=>'yes' or 'no',     # optional, default 'yes'.
```
