Hi,
I've used XML::Rabbit to help me parse XML files into objects for lots of different projects. It works beautifully (thank you).
I now need to create some of these XML::Rabbit objects from a non-XML source (ie database) and export as XML. I would like to reuse as much code as possible.
I'm using MooseX::Templated to export the XML and that works fine (see test case).
I just need to be able to create the objects manually rather than from XML source, eg
Foo->new( id => 'my id', bars => [ Foo::Bar->new() ] );
Doing this currently makes XML::Rabbit complain about missing required attributes and not providing file, xml, etc.
Attribute (_node), passed as (node), is required at constructor Foo::Bar::new
(defined at /[...]/.plenv/versions/5.12.5/lib/perl5/site_perl/5.12.5/XML/Rabbit/Sugar.pm line 136) line 30
So, do you have any suggestions for the best way to go about bypassing all the XML::Rabbit requirements and just fallback to the requirements of the Moose attributes?
I'm playing about with a test case here. I'm happy to write it up as a PR if you could point me in the right direction.
Best,
Ian
Hi,
I've used
XML::Rabbitto help me parse XML files into objects for lots of different projects. It works beautifully (thank you).I now need to create some of these
XML::Rabbitobjects from a non-XML source (ie database) and export as XML. I would like to reuse as much code as possible.I'm using
MooseX::Templatedto export the XML and that works fine (see test case).I just need to be able to create the objects manually rather than from XML source, eg
Doing this currently makes
XML::Rabbitcomplain about missing required attributes and not providingfile,xml, etc.So, do you have any suggestions for the best way to go about bypassing all the XML::Rabbit requirements and just fallback to the requirements of the Moose attributes?
I'm playing about with a test case here. I'm happy to write it up as a PR if you could point me in the right direction.
Best,
Ian