POE-Filter-XML-1.140700000755001750001750 012307703417 15041 5ustar00nicholasnicholas000000000000README100644001750001750 50712307703417 15764 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700 This archive contains the distribution POE-Filter-XML, version 1.140700: XML parsing for the POE framework This software is copyright (c) 2014 by Nicholas R. Perez . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Changes100644001750001750 565612307703417 16431 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700Revision history for POE-Filter-XML: 1.140700 1.140700 2014-03-11 22:58:37 Europe/Amsterdam Remove all bullshit related to MooseX::Declare Fix annoying bug in toString picking up Moose attributes 1.102960 2010-10-23 01:35:46 America/Chicago Fix issues with not_streaming Deprecation warning for ALL CAPS parameters improved Add a test for the not_streaming functionality Clean up some trailing whitespace 1.102800 2010-10-07 03:08:23 America/Chicago Overhaul internals to use MooseX::Declare Remove Utils.pm (No one should be using it) Redo documentation using Pod::Weaver Remove all 5.10isms (should be clean wherever MXD runs) Distribution now controlled by Dist::Zilla 2009-04-18 NPEREZ * Version 0.38 * Alter tests because of incoming smart match changes in blead perl 2009-04-18 NPEREZ * Version 0.37 * Remove dependency on Class::InsideOut * Remove dependency on Filter::Template * Node is now using fieldhash + state * Repo is now hosted at github 2009-04-06 NPEREZ * Version 0.36 * fixed a bug dealing with subclassing PFX::Node further 2009-01-04 NPEREZ * Version bumped to 0.35 * XML::LibXML support complete * Node completely rewritten to be based on LibXML::Element * Actual tests added for the filter, node, etc * Documentation updated to reflect these major changes * No more Makefile.PL 2008-12-31 NPEREZ * No version * Implement initial XML::LibXML port 2007-04-19 NPEREZ * Version bumped to 0.34 * Added support for multiple single document parsing (ie. XMLRPC) * Changed internal structure to be arrayref based * Provided arguments must be named pairs (ie NOTSTREAMING => 1) 2007-01-19 NPEREZ * Version bumped to 0.33 (in all modules so everything matches) * Add definedness checks for a couple of more items in Utils 2006-12-16 NPEREZ * Version bumpted to 0.32 (I know, I skipped one) * rt.cpan.org #23668: Add a check for defined-ness for encode/decode * Thanks to David Davis for bug submit 2006-10-26 NPEREZ * Version bumped to 0.30 * rt.cpan.org #22290: attribute values are properly encoded/decoded * rt.cpan.org #22291: attribute values are properly encoded/decoded * rt.cpan.org #22288: behavior made consistent on reset() and reset() has been moved to an internal method automagically called * rt.cpan.org #22427: now we subclass POE::Filter to make Filter::Stackable happy. * encode/decode moved out to Utils * Thanks to Eric Waters for bug submits 2006-04-30 NPEREZ * Version bumped to 0.29 * Clean up some more POE::Preprocessor leftovers 2006-04-30 NPEREZ * Version bumped to 0.28 * '0' in CDATA logic error corrected * Transition from MakeMaker to Module::Build LICENSE100644001750001750 4376012307703417 16161 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700This software is copyright (c) 2014 by Nicholas R. Perez . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Nicholas R. Perez . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Nicholas R. Perez . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End dist.ini100644001750001750 71312307703417 16547 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700name = POE-Filter-XML author = Nicholas R. Perez license = Perl_5 copyright_holder = Nicholas R. Perez copyright_year = 2014 [@Basic] [AutoVersion] [PkgVersion] [PodWeaver] [AutoPrereqs] [Prereqs] MooseX::InsideOut = 0 MooseX::NonMoose = 0 [NextRelease] [PodSyntaxTests] [MetaJSON] [MetaResources] repository.url = git://nickandperla.net/pfx.git repository.type = git [@Git] META.yml100644001750001750 130612307703417 16373 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700--- abstract: 'XML parsing for the POE framework' author: - 'Nicholas R. Perez ' build_requires: Test::More: 0 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: POE-Filter-XML requires: Carp: 0 Exporter: 0 Moose: 0 Moose::Object: 0 MooseX::InsideOut: 0 MooseX::NonMoose: 0 POE::Filter: 0 XML::LibXML: 0 XML::LibXML::Element: 0 XML::SAX::Base: 0 constant: 0 strict: 0 warnings: 0 resources: repository: git://nickandperla.net/pfx.git version: 1.140700 MANIFEST100644001750001750 37012307703417 16233 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/POE/Filter/XML.pm lib/POE/Filter/XML/Handler.pm lib/POE/Filter/XML/NS.pm lib/POE/Filter/XML/Node.pm t/00-load.t t/01-node.t t/02-filter.t t/release-pod-syntax.t weaver.ini META.json100644001750001750 261412307703417 16546 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700{ "abstract" : "XML parsing for the POE framework", "author" : [ "Nicholas R. Perez " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "POE-Filter-XML", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Carp" : "0", "Exporter" : "0", "Moose" : "0", "Moose::Object" : "0", "MooseX::InsideOut" : "0", "MooseX::NonMoose" : "0", "POE::Filter" : "0", "XML::LibXML" : "0", "XML::LibXML::Element" : "0", "XML::SAX::Base" : "0", "constant" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "Test::More" : "0" } } }, "release_status" : "stable", "resources" : { "repository" : { "type" : "git", "url" : "git://nickandperla.net/pfx.git" } }, "version" : "1.140700" } weaver.ini100644001750001750 117412307703417 17117 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700[@CorePrep] [Name] [Version] [Generic / SYNOPSIS] [Generic / DESCRIPTION] [Generic / OVERVIEW] [Collect / CLASS_METHODS] command = class_method [Collect / PUBLIC_ATTRIBUTES] command = attribute_public [Collect / PROTECTED_ATTRIBUTES] command = attribute_protected [Collect / PRIVATE_ATTRIBUTES] command = attribute_private [Collect / PUBLIC_METHODS] command = method_public [Collect / PROTECTED_METHODS] command = method_protected [Collect / PRIVATE_METHODS] command = method_private [Collect / TYPES] command = type [Collect / COERCIONS] command = coerce [Collect / CONSTANTS] command = constant [Leftovers] [Authors] [Legal] t000755001750001750 012307703417 15225 5ustar00nicholasnicholas000000000000POE-Filter-XML-1.14070000-load.t100644001750001750 33612307703417 16670 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/tuse warnings; use strict; use Test::More; BEGIN { use_ok( 'POE::Filter::XML' ); use_ok( 'POE::Filter::XML::Handler' ); use_ok( 'POE::Filter::XML::Node' ); use_ok( 'POE::Filter::XML::NS' ); } done_testing(); 01-node.t100644001750001750 443712307703417 16725 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/tuse warnings; use strict; use Test::More; use POE::Filter::XML::Node; my $node = POE::Filter::XML::Node->new('test'); isa_ok($node, 'POE::Filter::XML::Node'); is($node->nodeName(), 'test', 'Test Node Name'); $node->setAttributes( ['to', 'foo@other', 'from', 'bar@other', 'type', 'get'] ); is($node->getAttribute('to'), 'foo@other', 'Check attribute one'); is($node->getAttribute('from'), 'bar@other', 'Check attribute two'); is($node->getAttribute('type'), 'get', 'Check attribute three'); for(0..4) { $node->appendTextChild('child1', 'Some Text'); $node->appendTextChild('child2', 'Some Text2'); } my $node2 = $node->getSingleChildByTagName('child1'); is(ref($node2), 'POE::Filter::XML::Node', 'Check getSingleChildByTagName returns a proper subclass'); my $hash = $node->getChildrenHash(); is(ref($hash->{'child1'}), 'ARRAY', 'Check children1 are in an array'); is(ref($hash->{'child2'}), 'ARRAY', 'Check children2 are in an array'); is(scalar(@{$hash->{'child1'}}), 5, 'Check there are five children1'); is(scalar(@{$hash->{'child2'}}), 5, 'Check there are five children2'); foreach my $value (values %$hash) { foreach my $child (@$value) { is(ref($child), 'POE::Filter::XML::Node', 'Test each node is a proper subclass'); } } $node->_set_stream_start(1); is($node->stream_start(), 1, 'Check stream_start'); is($node->toString(), '', 'Check toString() for stream_start'); $node->_set_stream_start(0); $node->_set_stream_end(1); is($node->stream_end(), 1, 'Check stream_end'); is($node->toString(), '', 'Check toString() for stream_end'); my $clone = $node->cloneNode(1); is(ref($clone), 'POE::Filter::XML::Node', 'Check clone returns a proper subclass'); my $clonehash = $clone->getChildrenHash(); foreach my $value (values %$clonehash) { foreach my $child (@$value) { is(ref($child), 'POE::Filter::XML::Node', 'Test each clone node is a proper subclass'); } } is($clone->stream_start(), $node->stream_start(), 'Check clone semantics for stream_start'); is($clone->stream_end(), $node->stream_end(), 'Check clone semantics for stream_end'); $clone->_set_stream_end(0); $node->_set_stream_end(0); is($clone->toString(), $node->toString(), 'Check the clone against the original'); done_testing(); Makefile.PL100644001750001750 243712307703417 17102 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700 use strict; use warnings; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "XML parsing for the POE framework", "AUTHOR" => "Nicholas R. Perez ", "BUILD_REQUIRES" => { "Test::More" => 0 }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "POE-Filter-XML", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "POE::Filter::XML", "PREREQ_PM" => { "Carp" => 0, "Exporter" => 0, "Moose" => 0, "Moose::Object" => 0, "MooseX::InsideOut" => 0, "MooseX::NonMoose" => 0, "POE::Filter" => 0, "XML::LibXML" => 0, "XML::LibXML::Element" => 0, "XML::SAX::Base" => 0, "constant" => 0, "strict" => 0, "warnings" => 0 }, "VERSION" => "1.140700", "test" => { "TESTS" => "t/*.t" } ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); 02-filter.t100644001750001750 523212307703417 17260 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/tuse warnings; use strict; use Test::More; use POE::Filter::XML; my $xml = 'THIS IS SOME TEXT'; my $filter = POE::Filter::XML->new(); isa_ok($filter, 'POE::Filter::XML'); $filter->get_one_start([$xml]); while(1) { my $aref = $filter->get_one(); if(!@$aref) { last; } my $node = $aref->[0]; if( $node->stream_start() ) { pass('Got stream start 1/3'); is(ref($node), 'POE::Filter::XML::Node', 'Got stream start 2/3'); is($node->nodeName(), 'stream', 'Got stream start 3/3'); } if( $node->stream_end() ) { pass('Got stream end 1/3'); is(ref($node), 'POE::Filter::XML::Node', 'Got stream end 2/3'); is($node->nodeName(), 'stream', 'Got stream end 3/3'); } if( $node->nodeName() eq 'iq' ) { pass('Got iq 1/13'); is(ref($node), 'POE::Filter::XML::Node', 'Got iq 2/13'); is($node->getAttribute('from'), 'blah.com', 'Got iq 3/13'); is($node->getAttribute('type'), 'result', 'Got iq 4/13'); is($node->getAttribute('to'), 'blah@blah.com/foo', 'Got iq 5/13'); is($node->getAttribute('id'), 'abc123', 'Got iq 6/13'); my $child = $node->getSingleChildByTagName('service'); ok(defined($child), 'Got iq 7/13'); is(ref($child), 'POE::Filter::XML::Node', 'Got iq 8/13'); is($child->getAttribute('type'), 'jabber', 'Got iq 9/13'); is($child->getAttribute('name'), 'Server', 'Got iq 10/13'); is($child->getAttribute('jid'), 'blah.com', 'Got iq 11/13'); ok(scalar($child->getNamespaces()), 'Got iq 12/13'); is(($child->getNamespaces())[0]->value(), 'jabber:iq:browse', 'Got iq 13/13'); } if( $node->nodeName() eq 'presence' ) { pass('Got presence 1/4'); is(ref($node), 'POE::Filter::XML::Node', 'Got presence 2/4'); is($node->getAttribute('from'), 'baz@blah.com/bar', 'Got presence 3/4'); is($node->getAttribute('to'), 'blah@blah.com/foo', 'Got presence 4/4'); } if( $node->nodeName() eq 'testnode' ) { pass('Got testnode 1/3'); is(ref($node), 'POE::Filter::XML::Node', 'Got testnode 2/3'); is($node->textContent(), 'THIS IS SOME TEXT', 'Got testnode 3/3'); } } $filter = POE::Filter::XML->new(not_streaming => 1); $filter->get_one_start([$xml]); my $node = $filter->get_one()->[0]; is(length($node->toString()), length($xml), 'not_streaming works'); done_testing(); Filter000755001750001750 012307703417 17400 5ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/lib/POEXML.pm100644001750001750 1505212307703417 20561 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/lib/POE/Filterpackage POE::Filter::XML; { $POE::Filter::XML::VERSION = '1.140700'; } #ABSTRACT: XML parsing for the POE framework use Moose; use MooseX::NonMoose; extends 'Moose::Object','POE::Filter'; use Carp; use XML::LibXML; use POE::Filter::XML::Handler; has buffer => ( is => 'ro', traits => [ 'Array' ], isa => 'ArrayRef', lazy => 1, clearer => '_clear_buffer', default => sub { [] }, handles => { has_buffer => 'count', all_buffer => 'elements', push_buffer => 'push', shift_buffer => 'shift', join_buffer => 'join', } ); has callback => ( is => 'ro', isa => 'CodeRef', lazy => 1, default => sub { sub { Carp::confess('Parsing error happened: '. join("\n", @_)) } }, ); has handler => ( is => 'ro', isa => 'POE::Filter::XML::Handler', lazy => 1, builder => '_build_handler', ); has parser => ( is => 'ro', isa => 'XML::LibXML', lazy => 1, builder => '_build_parser', clearer => '_clear_parser' ); has not_streaming => ( is => 'ro', isa => 'Bool', default => 0, ); sub _build_handler { my ($self) = @_; POE::Filter::XML::Handler->new(not_streaming => $self->not_streaming) } sub _build_parser { my ($self) = @_; XML::LibXML->new(Handler => $self->handler) } sub BUILD { my ($self) = @_; if($self->has_buffer) { eval { $self->parser->parse_chunk($self->join_buffer("\n")); 1; } or do { my $err = $@ || 'Zombie Error'; $self->callback->($err); }; $self->_clear_buffer(); } } sub reset { my ($self) = @_; $self->handler->reset(); $self->_clear_parser(); $self->_clear_buffer(); } sub get_one_start { my ($self, $raw) = @_; if (defined $raw) { foreach my $raw_data (@$raw) { $self->push_buffer(split(/(?=\x0a?\x0d|\x0d\x0a?)/s, $raw_data)); } } } sub get_one { my ($self) = @_; if($self->handler->has_finished_nodes()) { return [$self->handler->get_finished_node()]; } else { while($self->has_buffer()) { my $line = $self->shift_buffer(); eval { $self->parser->parse_chunk($line); 1; } or do { my $err = $@ || 'Zombie error'; $self->callback->($err); }; if($self->handler->has_finished_nodes()) { my $node = $self->handler->get_finished_node(); if($node->stream_end() or $self->not_streaming) { $self->parser->parse_chunk('', 1); $self->reset(); } return [$node]; } } return []; } } sub put { my ($self, $nodes) = @_; my $output = []; foreach my $node (@$nodes) { if($node->stream_start()) { $self->reset(); } push(@$output, $node->toString()); } return $output; } 1; =pod =head1 NAME POE::Filter::XML - XML parsing for the POE framework =head1 VERSION version 1.140700 =head1 SYNOPSIS use POE::Filter::XML; my $filter = POE::Filter::XML->new(); my $wheel = POE::Wheel:ReadWrite->new( Filter => $filter, InputEvent => 'input_event', ); =head1 DESCRIPTION POE::Filter::XML provides POE with a completely encapsulated XML parsing strategy for POE::Wheels that will be dealing with XML streams. The parser is XML::LibXML =head1 PUBLIC_ATTRIBUTES =head2 not_streaming is: ro, isa: Bool, default: false Setting the not_streaming attribute to true via new() will put this filter into non-streaming mode, meaning that whole documents are parsed before nodes are returned. This is handy for XMLRPC or other short documents. =head1 PRIVATE_ATTRIBUTES =head2 buffer is: ro, isa: ArrayRef, traits: Array buffer holds the raw data to be parsed. Raw data should be split on network new lines before being added to the buffer. Access to this attribute is provided by the following methods: handles => { has_buffer => 'count', all_buffer => 'elements', push_buffer => 'push', shift_buffer => 'shift', join_buffer => 'join', } =head2 callback is: ro, isa: CodeRef callback holds the CodeRef to be call in the event that there is an exception generated while parsing content. By default it holds a CodeRef that simply calls Carp::confess. =head2 handler is: ro, isa: POE::Filter::XML::Handler handler holds the SAX handler to be used for processing events from the parser. By default POE::Filter::XML::Handler is instantiated and used. The L attribute is passed to the constructor of Handler. =head2 parser is: ro, isa: XML::LibXML parser holds an instance of the XML::LibXML parser. The L attribute is passed to the constructor of XML::LibXML. =head1 PUBLIC_METHODS =head2 get_one_start (ArrayRef $raw?) This method is part of the POE::Filter API. See L for an explanation of its usage. =head2 get_one returns (ArrayRef) This method is part of the POE::Filter API. See L for an explanation of its usage. =head2 put (ArrayRef $nodes) returns (ArrayRef) This method is part of the POE::Filter API. See L for an explanation of its usage. =head1 PROTECTED_METHODS =head2 reset reset() is an internal method that gets called when either a stream_start(1) POE::Filter::XML::Node gets placed into the filter via L, or when a stream_end(1) POE::Filter::XML::Node is pulled out of the queue of finished Nodes via L. This facilitates automagical behavior when using the Filter within the XMPP protocol that requires many new stream initiations. This method is also called after every document when not in streaming mode. Useful for handling XMLRPC processing. This method really should never be called outside of the Filter, but it is documented here in case the Filter is used outside of the POE context. =head1 PRIVATE_METHODS =head2 BUILD A BUILD method is provided to parse the initial buffer (if any was included when constructing the filter). =head1 AUTHOR Nicholas R. Perez =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Nicholas R. Perez . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ release-pod-syntax.t100644001750001750 45012307703417 21255 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/t#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); XML000755001750001750 012307703417 20040 5ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/lib/POE/FilterNS.pm100644001750001750 640212307703417 21060 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/lib/POE/Filter/XMLpackage POE::Filter::XML::NS; { $POE::Filter::XML::NS::VERSION = '1.140700'; } #ABSTRACT: Provides constants that return appropriate namespace strings use strict; use warnings; use constant { XMLNS_STREAM => 'http://etherx.jabber.org/streams', NS_JABBER_CLIENT => 'jabber:client', NS_JABBER_COMPONENT => 'http://jabberd.jabberstudio.org/ns/component/1.0', NS_JABBER_ACCEPT => 'jabber:component:accept', NS_JABBER_CONNECT => 'jabber:component:connect', NS_JABBER_DIALBACK => 'jabber:server:dialback', NS_JABBER_AUTH => 'jabber:iq:auth', NS_JABBER_REGISTER => 'jabber:iq:register', NS_JABBER_DISCOINFO => 'http://jabber.org/protocol/disco#info', NS_JABBER_DISCOITEMS => 'http://jabber.org/protocol/disco#items', NS_JABBER_ROSTER => 'jabber:iq:roster', NS_XMPP_SASL => 'urn:ietf:params:xml:ns:xmpp-sasl', NS_XMPP_TLS => 'urn:ietf:params:xml:ns:xmpp-tls', NS_XMPP_BIND => 'urn:ietf:params:xml:ns:xmpp-bind', NS_XMPP_STANZA => 'urn:ietf:params:xml:ns:xmpp-stanzas', NS_XMPP_SESSION => 'urn:ietf:params:xml:ns:xmpp-session', NS_XMPP_STREAMS => 'urn:ietf:params:xml:ns:xmpp-streams', NS_XMPP_OTHER => '##other', IQ_GET => 'get', IQ_SET => 'set', IQ_ERROR => 'error', IQ_RESULT => 'result', }; require Exporter; our @ISA = qw/ Exporter /; our @EXPORT_OK = qw/ NS_JABBER_CLIENT NS_JABBER_ACCEPT NS_JABBER_CONNECT NS_JABBER_COMPONENT NS_XMPP_SASL NS_JABBER_DISCOINFO NS_JABBER_DISCOITEMS IQ_GET IQ_SET IQ_ERROR IQ_RESULT NS_JABBER_AUTH NS_JABBER_REGISTER NS_DISCOINFO NS_DISCOITEMS XMLNS_STREAM NS_JABBER_ROSTER NS_XMPP_STANZA NS_XMPP_OTHER NS_XMPP_SESSION NS_XMPP_BIND NS_XMPP_TLS NS_XMPP_STREAMS/; our %EXPORT_TAGS = ( JABBER => [ qw/ NS_JABBER_DISCOINFO NS_JABBER_DISCOITEMS NS_JABBER_AUTH NS_JABBER_REGISTER NS_JABBER_CLIENT XMLNS_STREAM NS_JABBER_ROSTER NS_JABBER_ACCEPT NS_JABBER_CONNECT NS_JABBER_COMPONENT NS_XMPP_SASL NS_XMPP_STANZA NS_XMPP_TLS NS_XMPP_BIND NS_XMPP_SESSION NS_XMPP_OTHER NS_XMPP_STREAMS/ ], IQ => [ qw/ IQ_GET IQ_SET IQ_ERROR IQ_RESULT / ]); my %seen; push @{$EXPORT_TAGS{'all'}}, grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS; 1; =pod =head1 NAME POE::Filter::XML::NS - Provides constants that return appropriate namespace strings =head1 VERSION version 1.140700 =head1 SYNOPSIS use POE::Filter::XML::NS qw/ :JABBER :IQ /; =head1 DESCRIPTION POE::Filter::XML::NS provides namespace constants for use within POE::Filter::XML::Nodes (or any other representation) that requires namespace matching. The following export tags are explained below: =over 4 =item :JABBER ":JABBER" tag will import various useful constants for use within a normal Jabber client and component(to reference implementation server) situation. =item ":IQ" ":IQ" tag imports convenience packet types such as set, get, result, and error =item ":all" ":all" will import every tag available within the package. =back Please reference the source file to know which namespaces are explictly supported and exported. =head1 AUTHOR Nicholas R. Perez =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Nicholas R. Perez . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ Node.pm100644001750001750 1576512307703417 21461 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/lib/POE/Filter/XMLpackage POE::Filter::XML::Node; { $POE::Filter::XML::Node::VERSION = '1.140700'; } #ABSTRACT: A XML::LibXML::Element subclass that adds streaming semantics use Moose; use MooseX::NonMoose; use MooseX::InsideOut; extends 'XML::LibXML::Element'; use XML::LibXML(':libxml'); has stream_start => (is => 'ro', writer => '_set_stream_start', isa => 'Bool', default => 0); has stream_end => (is => 'ro', writer => '_set_stream_end', isa => 'Bool', default => 0); sub BUILDARGS { my ($self, $name) = @_; #only a name should be passed return { name => $name }; } sub cloneNode { my ($self, $deep) = @_; my $clone = $self->SUPER::cloneNode($deep); bless($clone, $self->meta->name()); $clone->_set_stream_start($self->stream_start()); $clone->_set_stream_end($self->stream_end()); return $clone; } sub getChildrenByTagName { my ($self, $name) = @_; my $CLASS = $self->meta->name(); return (map { bless($_, $CLASS) } @{ $self->SUPER::getChildrenByTagName($name) }); } sub getChildrenByTagNameNS { my ($self, $nsURI, $localname) = @_; my $CLASS = $self->meta->name(); return (map { bless($_, $CLASS) } @{ $self->SUPER::getChildrenByTagNameNS($nsURI, $localname) }); } sub getChildrenByLocalName { my ($self, $localname) = @_; my $CLASS = $self->meta->name(); return (map { bless($_, $CLASS) } @{ $self->SUPER::getChildrenByLocalName($localname) }); } sub getElementsByTagName { my ($self, $name) = @_; my $CLASS = $self->meta->name(); return (map { bless($_, $CLASS) } @{ $self->SUPER::getElementsByTagName($name) }); } sub getElementsByTagNameNS { my ($self, $nsURI, $localname) = @_; my $CLASS = $self->meta->name(); return (map { bless($_, $CLASS) } @{ $self->SUPER::getElementsByTagNameNS($nsURI, $localname) }); } sub getElementsByLocalName { my ($self, $localname) = @_; my $CLASS = $self->meta->name(); return (map { bless($_, $CLASS) } @{ $self->SUPER::getElementsByLocalName($localname) }); } sub toString { my ($self, $formatted, $docencoding) = @_; $formatted = defined($formatted) ? $formatted : 0; $docencoding = defined($docencoding) ? $docencoding : 0; if($self->stream_start()) { my $string = '<'; $string .= $self->nodeName(); foreach my $attr ($self->attributes()) { $string .= sprintf(' %s="%s"', $attr->nodeName(), $attr->value()); } $string .= '>'; return $string; } elsif ($self->stream_end()) { return sprintf('', $self->nodeName()); } else { return $self->SUPER::toString($formatted, $docencoding); } } sub setAttributes { my ($self, $array) = @_; for(my $i = 0; $i < scalar(@$array); $i++) { if($array->[$i] eq 'xmlns') { $self->setNamespace($array->[++$i], '', 0); } else { $self->setAttribute($array->[$i], $array->[++$i]); } } } sub getAttributes { my ($self) = @_; my $attributes = {}; foreach my $attrib ($self->attributes()) { if($attrib->nodeType == XML_ATTRIBUTE_NODE) { $attributes->{$attrib->nodeName()} = $attrib->value(); } } return $attributes; } sub getSingleChildByTagName { my ($self, $name) = @_; my $node = ($self->getChildrenByTagName($name))[0]; return undef if not defined($node); return $node; } sub getChildrenHash { my ($self) = @_; my $children = {}; foreach my $child ($self->getChildrenByTagName("*")) { my $name = $child->nodeName(); if(!exists($children->{$name})) { $children->{$name} = []; } push(@{$children->{$name}}, $child); } return $children; } 1; =pod =head1 NAME POE::Filter::XML::Node - A XML::LibXML::Element subclass that adds streaming semantics =head1 VERSION version 1.140700 =head1 SYNOPSIS use POE::Filter::XML::Node; my $node = POE::Filter::XML::Node->new('iq'); $node->setAttributes( ['to', 'foo@other', 'from', 'bar@other', 'type', 'get'] ); my $query = $node->addNewChild('jabber:iq:foo', 'query'); $query->appendTextChild('foo_tag', 'bar'); say $node->toString(); -- (newlines and tabs for example only) bar =head1 DESCRIPTION POE::Filter::XML::Node is a XML::LibXML::Element subclass that aims to provide a few extra convenience methods and light integration into a streaming context. This module can be used to create arbitrarily complex XML data structures that know how to stringify themselves. =head1 PUBLIC_ATTRIBUTES =head2 stream_[start|end] is: ro, isa: Bool, default: false These two attributes define behaviors to toString() for the node. In the case of stream_start, this means dropping all children and merely leaving the tag unterminated (eg. ). For stream_end, it will drop any children and treat the tag like a terminator (eg. ). Each attribute has a private writer ('_set_stream_[start|end]') if it necessary to manipulate these attributes post construction. =head1 PUBLIC_METHODS =head2 override cloneNode (Bool $deep) cloneNode is overriden to carry forward the stream_[end|start] attributes =head2 override toString (Bool $formatted) toString was overridden to provide special stringification semantics for when stream_start or stream_end are boolean true. =head2 setAttributes (ArrayRef $array_of_tuples) setAttributes() accepts a single arguement: an array reference. Basically you pair up all the attributes you want to be into the node (ie. [attrib, value]) and this method will process them using setAttribute(). This is just a convenience method. If one of the attributes is 'xmlns', setNamespace() will be called with the value used as the $nsURI argument, with no prefix, and not activated. eg. ['xmlns', 'http://foo'] | V setNamespace($value, '', 0) | V =head2 getAttributes returns (HashRef) This method returns all of the attribute nodes on the Element (filtering out namespace declarations) as a HashRef. =head2 getFirstChildByTagName(Str $name) returns (Maybe[POE::Filter::XML::Node]) This is a convenience method that basically does: (getChildrenByTagName($name))[0] =head2 getChildrenHash returns (HashRef) getChildrenHash() returns a hash reference to all the children of that node. Each key in the hash will be node name, and each value will be an array reference with all of the children with that name. =head1 AUTHOR Nicholas R. Perez =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Nicholas R. Perez . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ Handler.pm100644001750001750 1521212307703417 22134 0ustar00nicholasnicholas000000000000POE-Filter-XML-1.140700/lib/POE/Filter/XMLpackage POE::Filter::XML::Handler; { $POE::Filter::XML::Handler::VERSION = '1.140700'; } #ABSTRACT: Default SAX Handler for POE::Filter::XML use Moose; use MooseX::NonMoose; extends 'XML::SAX::Base'; use POE::Filter::XML::Node; has current_node => ( is => 'rw', isa => 'POE::Filter::XML::Node', predicate => '_has_current_node', clearer => '_clear_current_node' ); has finished_nodes => ( is => 'ro', traits => ['Array'], isa => 'ArrayRef', default => sub { [] }, handles => { all_finished_nodes => 'elements', has_finished_nodes => 'count', add_finished_node => 'push', get_finished_node => 'shift', _clear_finished_nodes => 'clear', } ); has depth_stack => ( is => 'ro', traits => ['Array'], isa => 'ArrayRef', default => sub { [] }, clearer => '_clear_depth_stack', handles => { push_depth_stack => 'push', pop_depth_stack => 'pop', depth => 'count', } ); has not_streaming => ( is => 'ro', isa => 'Bool', default => 0 ); sub reset { my ($self) = @_; $self->_clear_current_node(); $self->_clear_finished_nodes(); $self->_clear_depth_stack(); } sub start_element { my ($self, $data) = @_; my $node = POE::Filter::XML::Node->new($data->{'Name'}); foreach my $attrib (values %{$data->{'Attributes'}}) { $node->setAttribute ( $attrib->{'Name'}, $attrib->{'Value'} ); } if($self->depth() == 0) { #start of a document $self->push_depth_stack($node); if($self->not_streaming) { $self->current_node($node); } else { $node->_set_stream_start(1); $self->add_finished_node($node); } } else { # Top level fragment $self->push_depth_stack($self->current_node); if($self->depth() == 2) { if($self->not_streaming) { $self->current_node->appendChild($node); } $self->current_node($node); } else { # Some node within a fragment $self->current_node->appendChild($node); $self->current_node($node); } } $self->SUPER::start_element($data); } sub end_element { my ($self, $data) = @_; if($self->depth() == 1) { if($self->not_streaming) { $self->add_finished_node($self->pop_depth_stack()); } else { my $end = POE::Filter::XML::Node->new($data->{'Name'}); $end->_set_stream_end(1); $self->add_finished_node($end); } } elsif($self->depth() == 2) { if($self->not_streaming) { $self->current_node($self->pop_depth_stack()); } else { $self->add_finished_node($self->current_node); $self->_clear_current_node(); $self->pop_depth_stack(); } } else { $self->current_node($self->pop_depth_stack()); } $self->SUPER::end_element($data); } sub characters { my ($self, $data) = @_; if($self->depth() == 1) { return; } $self->current_node->appendText($data->{'Data'}); $self->SUPER::characters($data); } 1; =pod =head1 NAME POE::Filter::XML::Handler - Default SAX Handler for POE::Filter::XML =head1 VERSION version 1.140700 =head1 DESCRIPTION POE::Filter::XML::Handler is the default SAX handler for POE::Filter::XML. It extends XML::SAX::Base to provide different semantics for streaming vs. non-streaming contexts. This handle by default builds POE::Filter::XML::Nodes. =head1 PUBLIC_ATTRIBUTES =head2 not_streaming is: ro, isa: Bool, default: false not_streaming determines the behavior for the opening tag parsed. If what is being parsed is not a stream, the document will be parsed in full then placed into the finished_nodes attribute. Otherwise, the opening tag will be placed immediately into the finished_nodes bucket. =head1 PRIVATE_ATTRIBUTES =head2 current_node is: rw, isa: POE::Filter::XML::Node current_node holds the node being immediately parsed. =head2 finished_nodes is: ro, isa: ArrayRef, traits: Array finished_nodes holds the nodes that have been completely parsed. Access to this attribute is provided through the following methods: handles => { all_finished_nodes => 'elements', has_finished_nodes => 'count', add_finished_node => 'push', get_finished_node => 'shift', } =head2 depth_stack is: ro, isa: ArrayRef, traits: Array depth_stack holds the operating stack for the parsed nodes. As nodes are processed, ancendants of the current node are stored in the stack. When done they are popped off the stack. Access to this attribute is provided through the following methods: handles => { push_depth_stack => 'push', pop_depth_stack => 'pop', depth => 'count', } =head1 PUBLIC_METHODS =head2 reset reset will clear the current node, the finished nodes, and the depth stack. =head1 PROTECTED_METHODS =head2 override start_element (HashRef $data) start_element is overriden from the XML::SAX::Base class to provide our custom behavior for dealing with streaming vs. non-streaming data. It builds Nodes then attaches them to either the root node (non-streaming) or as stand-alone top level fragments (streaming) sets them to the current node. Children nodes are appended to their parents before getting set as the current node. Then the base class method is called via super() =head2 override end_element (HashRef $data) end_element is overriden from the XML::SAX::Base class to provide our custom behavior for dealing with streaming vs. non-streaming data. Mostly this method is in charge of stack management when the depth of the stack reaches certain points. In streaming documents, this means that top level fragments (not root) are popped off the stack and added to the finished_nodes collection. Otherwise a Node is created with stream_end set and added to the finished nodes. Then the base class method is called via super() =head2 override characters (HashRef $data) characters merely applies the character data as text to the current node being processed. It then calls the base class method via super(). =head1 AUTHOR Nicholas R. Perez =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Nicholas R. Perez . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__