Kvasir::Loader::XML(3)User Contributed Perl DocumentationKvasir::Loader::XML(3)



NNAAMMEE
       Kvasir::Loader::XML - Load Kvasir engine declarations in XML

SSYYNNOOPPSSIISS
         use Kvasir::Loader::XML;

         my $engine = Kvasir::Loader::XML->load_file("my_engine.xml");
         $engine->run();

         my $other_engine = Kvasir::Loader::XML->load_string($xml);
         $other_engine->run();

DDEESSCCRRIIPPTTIIOONN
       This module provides a mean to load Kvasir engine declarations from
       XML.

IINNTTEERRFFAACCEE
       CCLLAASSSS MMEETTHHOODDSS


       load_file ( PATH )
           Loads the engine declaration from _P_A_T_H.

       load_string ( XML )
           Loads the engine declaration from _X_M_L.

XXMMLL DDooccuummeenntt ssttrruuccttuurree
       The document root element must be <<eennggiinnee>>. Valid children are:

       +o   <<aaccttiioonn>> - Declares an action.

       +o   <<ddeeffaauullttss>> - Defines a default argument set

       +o   <<iinnppuutt>> - Declares an input.

       +o   <<oouuttppuutt>> - Declares an output.

       +o   <<rruullee>> - Declares a rule.

       +o   <<rruulleesseett>> - Groups a set of rules under a common name.

       +o   <<rruunn>> - Connects a set of rules to an action.

       AAccttiioonn,, IInnppuutt,, OOuuttppuutt aanndd RRuullee eelleemmeennttss

       The elements <<aaccttiioonn>>, <<iinnppuutt>>, <<oouuttppuutt>> and <<rruullee>> all have the fol-
       lowing mandatory attributes:

       name
           The name of the entity to define in the engine.

       instanceOf
           The class that implements the entity and that'll be instansiated
           when the engine is runned.

       defaults
           The default arguments to the entity as defined by a previously
           declared <<ddeeffaauullttss>>.  Separate multiple defaults with comma and/or
           whitespace.

       If the class defined by _i_n_s_t_a_n_c_e_O_f implements the method
       "process_xml_loader_args" it will be called as a class method with the
       "XML::LibXML::Element"-element as only argument. This method must
       return a list of arguments that will be passed to the constructor for
       the class when the entity is instansiated.

       If no "process_xml_loader_args" method is available the loader will
       interpret all children as a hash where the elements name is the key and
       its text content its value. If a child is an empty element, that is has
       no children (as in "<foo/>") its value will be undef. This hash will be
       passed to the constructor as a hash reference.

       DDeeffaauullttss

       By using the tag <<ddeeffaauullttss>> t is possible to declare common arguments
       that can be reused by multiple entities. Its children will be inter-
       preted as key/value pairs. The required attribute 'name' defines the
       name for the defaults.

       RRuulleesseettss

       By using the tag <<rruulleesseett>> it is possible to give a set of rules a
       shared name that can later be used when binding together rules and
       actions.

       The attribute _n_a_m_e is always expected and is used to give the ruleset
       its name which can be referenced later on by other rulesets or
       rule<->action mappings.

       To specify what rules to include it expects <<rruullee>>nnaammee ooff rruullee<<//rruullee
       and/or <<rruulleesseett>>nnaammee ooff rruulleesseett<<//rruulleesseett>> elements as children. Any
       other element will result in an error.

       In addition to specifying specific rules or contens of other rulesets
       it is also possible to include the rules that matches the criteria
       specified by the attributes:

       rulesMatchingName
           Include all rules that matches the name by the given Perl5 regular
           expression.

       rulesOfClass
           Include all rules which inherits from the given class.

       Note, if both attributes above are present it does not create a ruleset
       with the rule that matches both (i.e a union).

       CCoonnnneeccttiinngg rruulleess aanndd aaccttiioonnss

       To connect an action to a rule use the <<rruunn>> element. It expects the
       attribute _a_c_t_i_o_n which must be the name of an already defined action.
       Which rules to invoke the action on is specified with children of type
       <<rruullee>>nnaammee ooff rruullee<<//rruullee and/or <<rruulleesseett>>nnaammee ooff rruulleesseett<<//rruulleesseett>>. Any
       other element will result in an error.

SSEEEE AALLSSOO
       Kvasir

BBUUGGSS AANNDD LLIIMMIITTAATTIIOONNSS
       Please report any bugs or feature requests to
       "bug-kvasir-loader-xml@rt.cpan.org", or through the web interface at
       <http://rt.cpan.org>.

AAUUTTHHOORR
       Claes Jakobsson "<claesjac@cpan.org>"

LLIICCEENNCCEE AANNDD CCOOPPYYRRIIGGHHTT
       Copyright (c) 2007, Versed Solutions "<info@versed.se>". All rights
       reserved.

       This software is released under the MIT license cited below.

       TThhee ""MMIITT"" LLiicceennssee

       Permission is hereby granted, free of charge, to any person obtaining a
       copy of this software and associated documentation files (the "Soft-
       ware"), to deal in the Software without restriction, including without
       limitation the rights to use, copy, modify, merge, publish, distribute,
       sublicense, and/or sell copies of the Software, and to permit persons
       to whom the Software is furnished to do so, subject to the following
       conditions:

       The above copyright notice and this permission notice shall be included
       in all copies or substantial portions of the Software.

       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER-
       CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
       NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT-
       WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



perl v5.8.6                       2007-10-08            Kvasir::Loader::XML(3)
