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

NAME

XML::Struct::Reader - Read ordered XML from a stream

VERSION

version 0.03

SYNOPSIS

    my $stream = XML::LibXML::Reader->new( location => "file.xml" );
    my $stream = XML::Struct::Reader->new;
    my $data = $stream->read( $stream );

DESCRIPTION

This module reads from an XML stream via XML::LibXML::Reader and return a Perl data structure with ordered XML (see XML::Struct).

METHODS

new( %options )

Create a new reader. By default whitespace is ignored, unless enabled with option whitespace. The option attributes can be set to false to omit all attributes from the result.

read( $stream )

Read the root element or the next element element. This method is a shortcut for readNext( $stream, '*' ).

readElement( $stream )

Read an XML element from a stream and return it as array reference with element name, attributes, and child elements. In contrast to method read, this method expects the stream to be at an element node ($stream->nodeType == 1) or bad things might happed.

readNext( $stream, $path )

Read the next element from a stream. The experimental option $path can be used to specify an element name (the empty string or "*" match all element nodes) and a path, such as /some/element. The path operator "../" is not supported.

readContent( $stream )

Read all child elements of an XML element and return the result as array reference or as empty list if no children were found. Significant whitespace is only included if option whitespace is enabled.

Read all XML attributes from a stream and return a hash reference or an empty list if no attributes were found.

AUTHOR

Jakob Voß

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Jakob Voß.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 169:

Unknown directive: =endocing

Around line 171:

Unknown directive: =head

Around line 178:

Non-ASCII character seen before =encoding in 'Voß'. Assuming UTF-8