NAME

Xacobeo::Document - An 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.

Parameters:

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

find

Runs the given XPath query on the document and returns the results. The results could be a node list or a single value like a boolean, a number or a scalar if an expression is passed.

Parameters:

$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.

Parameters:

$xpath: a valid XPath expression.

get_prefixed_name

Returns the node name by prefixing it with our prefixes in the case where namespaces are used.

AUTHORS

Emmanuel Rodriguez <potyl@cpan.org>.

COPYRIGHT AND LICENSE

Copyright (C) 2008 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.