NAME

Spreadsheet::XLSX::Reader::LibXML::XMLReader - A LibXML::Reader xlsx base class

SYNOPSIS

	package MyPackage;
	use MooseX::StrictConstructor;
	use MooseX::HasDefaults::RO;
	extends	'Spreadsheet::XLSX::Reader::LibXML::XMLReader';
    

DESCRIPTION

This documentation is written to explain ways to use this module when writing your own excel parser. To use the general package for excel parsing out of the box please review the documentation for Workbooks, Worksheets, and Cells

This module provides a generic way to open an xml file or xml file handle and then extract information using the XML::LibXML::Reader parser. The additional methods and attributes are intended to provide some coalated parsing commands that are specifically useful in turning xml to perl data structures.

Attributes

Data passed to new when creating an instance. For modification of these attributes see the listed 'attribute methods'. For general information on attributes see Moose::Manual::Attributes. For ways to manage the instance when opened see the Methods.

file

    Definition: This attribute holds the file handle for the file being read. If the full file name and path is passed to the attribute it is coerced to an IO::File file handle.

    Default: no default - this must be provided to read a file

    Required: yes

    Range: any unencrypted xml file name and path or IO::File file handle

    attribute methods Methods provided to adjust this attribute

      set_file

        Definition: change the file value in the attribute (this will reboot the file instance and lock the file)

      get_file

        Definition: Returns the file handle of the file even if a file name was passed

      has_file

        Definition: this is used to see if the file loaded correctly.

      clear_file

        Definition: this clears (and unlocks) the file handle

    "Delegated Methods"

      close

        closes the file handle

error_inst

    Definition: This attribute holds the error handler .

    Default: no default - this must be provided to read a file

    Required: yes

    Range: any object instance that can provide the required delegated methods.

    attribute methods Methods provided to adjust this attribute

      _clear_error_inst

        clear the attribute value

    _get_error_inst

      get the attribute value

Delegated Methods (required) Methods delegated to this module by the attribute

    error

      Definition: returns the currently stored error string

    set_error

      Definition: Sets the error string

    clear_error

      Definition: clears the error string

    set_warnings

      Definition: Sets the state that determins if the instance pro-activly warns with the error string when the error string is set.

    if_warn

      Definition: Returns the current state of the state value from 'set_warnings'

xml_version

    Definition: This stores the xml version stored in the xml header. It is read when the file handle is first set in this sheet.

    Default: no default - this is auto read from the header

    Required: no

    Range: xml versions

    attribute methods Methods provided to adjust this attribute

      _clear_xml_version

        clear the attribute value

    _set_xml_version

      set the attribute value

xml_encoding

    Definition: This stores the data encoding of the xml file from the xml header. It is read when the file handle is first set in this sheet.

    Default: no default - this is auto read from the header

    Required: no

    Range: valid xml file encoding

    attribute methods Methods provided to adjust this attribute

      encoding

        get the attribute value

      has_encoding

        predicate for the attribute value

      _clear_xml_encoding

        clear the attribute value

    _set_xml_encoding

      set the attribute value

xml_header

    Definition: This stores the xml header from the xml file. It is read when the file handle is first set in this sheet.

    Default: no default - this is auto read from the header

    Required: no

    Range: valid xml file header

    attribute methods Methods provided to adjust this attribute

      get_header

        get the attribute value

      _set_xml_header

        set the attribute value

position_index

    Definition: This attribute is available to facilitate other consuming roles and classes. Of the attribute methods only the 'clear_location' method is used in this class during the 'start_the_file_over' method. It can be used for tracking same level positions with the same node name.

    Default: no default - this is mostly managed by the child class or add on role

    Required: no

    Range: Integer

    attribute methods Methods provided to adjust this attribute

      where_am_i

        get the attribute value

      i_am_here

        set the attribute value

      clear_location

        clear the attribute value

      has_position

        set the attribute value

Methods

These are the methods provided by this class. They most likely should be agumented with file specific methods when extending this module.

start_the_file_over

    Definition: This will disconnect the XML::LibXML::Reader from the file handle, rewind the file handle, and then reconnect the XML::LibXML::Reader to the file handle.

    Accepts: nothing

    Returns: nothing

get_text_node

    Definition: This will collect the text node at the current node position. It will return two items ( $success_or_failure, $text_node_value )

    Accepts: nothing

    Returns: ( $success_or_failure(1|undef), ($text_node_value|undef) )

get_attribute_hash_ref

    Definition: Some nodes have attribute settings. This method returns a hashref with any attribute settings attached as key => value pairs or an empty hash for no attributes

    Accepts: nothing

    Returns: { attribute_1 => attribute_1_value ... etc. }

advance_element_position( [$node_name], [$number_of_times_to_index] )

    Definition: This method will attempt to advance to $node_name (optional) or the next node if no $node_name is passed. If there is an expectation of multiple nodes of the same name at the same level you can also pass $number_of_times_to_index (optional). This will move through the xml file at the $node_name level the number of times indicated starting with wherever the xml file is already located. Meaning $number_of_times_to_index is a relative index not an absolute index.

    Accepts: nothing

    Returns: success or failure for the method call

location_status

    Definition: This method gives three usefull location values with one call

    Accepts: nothing

    Returns: ( $node_depth (from the top of the file), $node_name, $node_type (xml numerical value for type) );

Delegated Methods

These are the methods delegated to this class from XML::LibXML::Reader. For more general parsing of subsections of the xml file also see Spreadsheet::XLSX::Reader::LibXML.

copy_current_node

SUPPORT

TODO

    1. Nothing currently

AUTHOR

Jed Lund
jandrew@cpan.org

COPYRIGHT

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

The full text of the license can be found in the LICENSE file included with this module.

This software is copyrighted (c) 2014, 2015 by Jed Lund

DEPENDENCIES

SEE ALSO