BPM::Engine::Util::XPDL - XPDL parsing helper functions
0.01
use BPM::Engine::Util::XPDL ':all'; $data = xpdl_hash($input); say $data->{WorkflowProcesses}->[0]->{Id};
This module provides helper functions for parsing of XPDL files and strings.
The first parameter to any function should be the XML message to be translated into a Perl structure. Choose one of the following:
If the filename contains no directory components, the function will look for the file in the current directory.
$ref = xpdl_hash('/etc/params.xml');
Note, the filename - (dash) can be used to parse from STDIN.
-
A string containing XML will be parsed directly.
my $string = '<Some>Thing</Some>'; $doc = xml_doc(\$string);
An IO::Handle object will be read to EOF and its contents parsed. eg:
$fh = IO::File->new('./xpdl/workflows.xpdl'); $doc = xml_doc($fh);
None of the functions are exported by default. The :all key exports all functions.
:all
my $data = xpdl_hash($input); say $data->{WorkflowProcesses}->[0]->{Id};
The result of xpdl_doc() parsed into a hash by BPM::XPDL. The resulting data hash represents the XPDL document.
xpdl_doc()
This is presumably the only function you'll need from this module.
my $data = xml_hash($input); say $data->{WorkflowProcesses}->[0]->{Id};
A 'lightweight' parsing of XPDL-like XML strings. Useful for testing. Example:
my $string = qq! <Package> <WorkflowProcesses> <WorkflowProcess Id="OrderPizza" Name="Order Pizza"> <Activities> <Activity Id="PlaceOrder" /> <Activity Id="WaitForDelivery" /> <Activity Id="PayPizzaGuy" /> </Activities> <Transitions> <Transition Id="1" From="PlaceOrder" To="WaitForDelivery"/> <Transition Id="2" From="WaitForDelivery" To="PayPizzaGuy"/> </Transitions> </WorkflowProcess> </WorkflowProcesses> </Package>!; my $data = xml_hash($string); say $data->{WorkflowProcesses}->[0]->{Id}; # prints 'OrderPizza'
This function will possibly be deprecated in the near future.
$doc = xml_doc($input);
Parses the given file (or URL), string, or input stream into a DOM tree.
Returns a XML::LibXML::Document object.
Parses the given file (or URL), string, or input stream (by calling xml_doc()) and does some checks on the document, specifically:
xml_doc()
Verify that the XPDL version in the document is supported;
Clean up modeler-proprietary elements and attributes for XPDL generated by the http://bizagi.com.
Validate the document against the XPDL schema
File::ShareDir
XML::LibXML
XML::LibXML::XPathContext
XML::LibXML::Simple
BPM::XPDL
Sub::Exporter
Peter de Vos <sitetech@cpan.org>
Copyright (c) 2010, 2011 Peter de Vos <sitetech@cpan.org>.
<sitetech@cpan.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
1 POD Error
The following errors were encountered while parsing the POD:
alternative text 'http://bizagi.com' contains non-escaped | or /
To install BPM::Engine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BPM::Engine
CPAN shell
perl -MCPAN -e shell install BPM::Engine
For more information on module installation, please visit the detailed CPAN module installation guide.