---
name: "Xacobeo::UI::SourceView"
section: "3pm"
platform: "linux"
package: "xacobeo"
version: "0.15-3+b2"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/Xacobeo::UI::SourceView"
---

# Xacobeo::UI::SourceView(3pm)

Text editor that displays XML.

## NAME

Xacobeo::UI::SourceView - Text editor that displays XML.

## SYNOPSIS

```
        use Xacobeo::Document;
        use Xacobeo::UI::SourceView;

        my $view = Xacobeo::UI::SourceView->new();
        $view->set_show_line_numbers(TRUE);
        $window->add($view);

        # Load a document
        my $document = Xacobeo::Document->new_from_file($file, $type);
        $view->set_document($document);
        $view->load_node($document->documentNode);
```

## DESCRIPTION

The text editor widget that's used for displaying XML. This widget is a Gtk2::SourceView2::View.

## PROPERTIES

### document

The document being displayed.

### namespaces

The namespaces registered in the document.

## METHODS

The following methods are available:

### new

Creates a new instance. This is simply the parent's constructor.

### set\_document

Sets a new document. This method only registers the document with the view, to display the document use the method load\_node and pass the root node.

Parameters:

- •

  `$document`

  The main document; an instance of Xacobeo::Document.

### show\_node

Scrolls the text so that the given node is displayed.

Parameters:

- •

  `$node`

  The node to show; an instance of XML::LibXML::Node.

### load\_node

Sets the editor's text according to the text representation of the given node. This is the method that will actually add text to the widget.

Parameters:

- •

  `$node`

  The node to be loaded into the editor; an instance of XML::LibXML::Node.

## AUTHORS

Emmanuel Rodriguez \<potyl@cpan.org\>.

## COPYRIGHT AND LICENSE

Copyright (C) 2008,2009 by Emmanuel Rodriguez.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
