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

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

## NAME

```
  GO::IO::RDFXML - 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::XML->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::XML(-output=>$out);
    $xml_out->start_document();
    $xml_out->draw_node_graph($term, 3677);
    $xml_out->end_document();
```

## DESCRIPTION

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

If there's a need I'll add draw\_node\_graph, draw\_node\_list, etc.

### new

```
    Usage   - my $xml_out = GO::IO::XML->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::XML(-output=\>$out);

### xml\_header

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

start\_document 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(-timestamp=>$time);
    Returns - None
    Args    - optional: timestamp string, pre-formatted
```

start\_ducument 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.

### end\_document

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

Call this when done.

### draw\_node\_graph

```
    Usage   - $xml_out->draw_node_graph(-graph=>$graph);
    Returns - None
    Args    -graph=>$node_graph,
            -focus=>$acc,                      ## optional
            -show_associations=>"yes" or "no"  ## optional
```

### draw\_term

```
    Usage   - $xml_out->draw_term();
    Returns - None
    Args    -term=>$term,
            -graph=>$graph,
            -is_focus=>"yes" or "no",    ## optional
            -show_associations=>"yes" or "no",    ## optional
            -show_terms=>"yes" or "no",    ## optional, just draws associations
```

###

sub characters

```
  This is simply a wrapper to XML::Writer->characters
  which strips out any non-ascii characters.
```

###

sub dataElement

```
  This is simply a wrapper to XML::Writer->dataElement
  which strips out any non-ascii characters.
```
