Spreadsheet::XLSX::Reader::LibXML::XMLReader - A LibXML::Reader xlsx base class
package MyPackage; use MooseX::StrictConstructor; use MooseX::HasDefaults::RO; extends 'Spreadsheet::XLSX::Reader::LibXML::XMLReader';
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.
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.
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
Definition: This attribute holds the error handler .
Range: any object instance that can provide the required delegated methods.
_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'
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
_clear_xml_version
_set_xml_version
set the attribute value
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.
Range: valid xml file encoding
encoding
has_encoding
predicate for the attribute value
_clear_xml_encoding
_set_xml_encoding
Definition: This stores the xml header from the xml file. It is read when the file handle is first set in this sheet.
Range: valid xml file header
get_header
_set_xml_header
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
Range: Integer
where_am_i
i_am_here
clear_location
has_position
These are the methods provided by this class. They most likely should be agumented with file specific methods when extending this module.
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
Definition: This will collect the text node at the current node position. It will return two items ( $success_or_failure, $text_node_value )
Returns: ( $success_or_failure(1|undef), ($text_node_value|undef) )
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
Returns: { attribute_1 => attribute_1_value ... etc. }
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.
Returns: success or failure for the method call
Definition: This method gives three usefull location values with one call
Returns: ( $node_depth (from the top of the file), $node_name, $node_type (xml numerical value for type) );
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.
Delegated from: "copyCurrentNode (deep)" in XML::LibXML::Reader
Returns an XML::LibXML::Node object
github Spreadsheet::XLSX::Reader::LibXML/issues
1. Nothing currently
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
XML::LibXML::Reader
Spreadsheet::ParseExcel - Excel 2003 and earlier
Spreadsheet::XLSX - 2007+
Spreadsheet::ParseXLSX - 2007+
Log::Shiras
All lines in this package that use Log::Shiras are commented out
To install Spreadsheet::XLSX::Reader::LibXML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Spreadsheet::XLSX::Reader::LibXML
CPAN shell
perl -MCPAN -e shell install Spreadsheet::XLSX::Reader::LibXML
For more information on module installation, please visit the detailed CPAN module installation guide.