NAME
XML::RelaxNG::Compact::PXB - create perl XML (RelaxNG Compact) data binding API
VERSION
Version 0.01
DESCRIPTION
The instance of this class is capable of generating the API tree of the perl objects
based on XML (RelaxNG compact) schema described as perl data structures. If you have bunch
of XML schemas ( and able to convert them into RelaxNG Compact ) and hate to waste your time
by writing DOM tree walking code then this module may help you. Of course POD will be created
automatically as well.
Also, it will build the tests suit automatically as well and provide perltidy and perlcritic
config files for you to assure the absence of problems in your API. The L<Perl::Critic> test will
be performed as part of the tests suit.
See L<XML::RelaxNG::Compact::DataModel> for more details and examples.
SYNOPSIS
METHODS
new({})
creates new object, accepts reference to hash as parameters container
where keys are:
DEBUG
- set it to something defined to provide extra loggingtop_dir
- full pathname to the api root dir, for example test files will be placed as top_dir/test_dir-
Default: C<current directory>
nsregistry
- reference to the hash with {ns_prefix => ns_URI} pairs, it will be built into the Element classdatatypes_root
- name of the generated datatypes directory-
Default: C<XMLTypes>
schema_version
- version identifier for your XML schema-
Default: C<1.0>
test_dir
- name for the test suit files ( relative to the <top_dir>)-
Default: C<t>
Possible ways to call B<new()>:
### with defaults
$api_builder = XML::RelaxNG::Compact::PXB->new();
## passes hashref with explicit parameters, for the next example:
## api will be created at /root/XMLTypes/v1_0/
## and tests files under - /root/t
$api_builder = XML::RelaxNG::Compact::PXB->new({
top_dir => "/root/",
datatypes_root => "XMLTypes",
nsregistry => { 'nsid' => 'nsURI'},
schema_version => "1.0",
test_dir => "t",
footer => POD::Credentials->new({author=> 'Joe Doe'}),
});
buildAPI
builds XML binding API recursively
accepts parameters:
- name of the root element - undef by default
- reference to the hash representing the RelaxNG Compact schema, empty hash ref by default
- parent - is
undef
for the root element
returns $self
buildHelpers
shortcut to build Helper classes only, no arguments
returns $self
buildAM
prints accessors and mutators for the passed reference to array of names
returns $self
buildTests
shortcut to build test files only, no arguments
returns $self
buildClass
builds single class on the filesystem and corresponded test file
accepts parameters:
- name of the element =item hashref with the element definition =item hashref with parent definition if its not the root element
returns $self
buildTest
auxiliary method
it builds test file for current class
accepts:
reference to array with elements,
reference to array with attributes,
class name
name of the package
element name
returns: nothing
saying
prints string into the file handler without new line
sayIt
prints string into the file handler with new line added
AUTHOR
Maxim Grigoriev (FNAL), maxim_at_fnal_dot_gov
LICENSE
You should have received a copy of the Fermitools license
with this software. If not, see <http://fermitools.fnal.gov/about/terms.html>
COPYRIGHT
Copyright(c) 2007-2008, Fermi Reasearch Alliance (FRA)