NAME

Xacobeo::Document - XML document and it's related information

SYNOPSIS

use Xacobeo::Document;

my $document Xacobeo::Document->new('file.xml');

my $namespaces = $document->namespaces(); # Hashref
while (my ($prefix, $uri) = each %{ $namespaces }) {
	printf "%-5s: %s\n", $prefix, $uri;
}

my @nodes = $document->findnodes('/x:html//x:a[@href]');
$document->validate('/x:html//x:a[@href]') or die "Invalid XPath expression";

DESCRIPTION

This package wraps an XML document with it's corresponding meta information ( namespaces, source, etc).

METHODS

The package defines the following methods:

new

Creates a new instance.

Paramters:

$source: the source of the XML document, this can be a file name.

findnodes

Runs the given XPath query on the document. The resutls are returned as a list. In scalar context the number of nodes are returned.

Paramters:

$xpath: a valid XPath expression.

validate

Validates the syntax of the given XPath query. The syntax is validated within a context that has the same namespaces as the ones defined in the current XML document.

Paramters:

$xpath: a valid XPath expression.