The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XAS::Lib::XML - A class to manipulate XML documents

SYNOPSIS

 use XAS::Lib::XML;
 
 my $xpath;
 my $buffer = <STDIN>;
 my $filename = 'schemna.xsd',

 my $xml = XAS::Lib::XML->new(
     -xsd => $filename,
 );

 $xml->load($buffer);
 if ($xml->is_valid) {

    $xpath = '//sif:SIF_Header/sif:SIF_SourceId';
    printf("value: %s\n", $xml->get_item($xpath));

 }

DESCRIPTION

This module is able to load, parse and validate a xml document.

METHODS

new

This method initialize the module and takes these parameters:

-xsd

The XML Schema to validate against.

-default_namespace

The default namespace to use, defaults to 'def'.

load($xml)

This method loads and parses a XML document.

$xml

The XML to load.

is_valid

This method validates the document to the XSD. If valid returns TRUE, otherwise throws an exception.

get_item($xpath)

This method will return the string valuse of the Xpath.

$xpath

The Xpath string.

get_items($xpath)

This method will return an array of nodes for the given Xpath.

$xpath

The Xpath string.

get_node($xpath)

This method will return the node associated with the xpath.

$xpath

The Xpath string.

xmlerr

A class method to return the full XML error string.

SEE ALSO

XAS
XML::LibXML

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (C) 2014 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.