Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Tomcat42
perl-XML-Toolkit
perl-XML-Toolkit.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-XML-Toolkit.spec of Package perl-XML-Toolkit
# # spec file for package perl-XML-Toolkit # # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: perl-XML-Toolkit Version: 0.15 Release: 0 %define cpan_name XML-Toolkit Summary: Suit of Xml Tools with Antlers License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/XML-Toolkit/ Source0: http://www.cpan.org/authors/id/P/PE/PERIGRIN/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Bread::Board) BuildRequires: perl(Bread::Board::Container) BuildRequires: perl(Devel::PackagePath) >= 0.01 BuildRequires: perl(Moose) >= 0.92 BuildRequires: perl(Moose::Role) BuildRequires: perl(Moose::Util::TypeConstraints) BuildRequires: perl(MooseX::Aliases) BuildRequires: perl(MooseX::App::Cmd) BuildRequires: perl(MooseX::App::Cmd::Command) BuildRequires: perl(MooseX::Getopt::Dashes) BuildRequires: perl(MooseX::MetaDescription) >= 0.03 BuildRequires: perl(MooseX::MetaDescription::Description) BuildRequires: perl(MooseX::MetaDescription::Meta::Attribute) BuildRequires: perl(MooseX::MetaDescription::Meta::Trait) BuildRequires: perl(MooseX::NonMoose) BuildRequires: perl(MooseX::Types::Path::Class) >= 0.04 BuildRequires: perl(Path::Class) BuildRequires: perl(Template) >= 2.20 BuildRequires: perl(Test::Deep) BuildRequires: perl(Test::Exception) BuildRequires: perl(Test::Simple) >= 0.94 BuildRequires: perl(Test::XML) >= 0.00 BuildRequires: perl(XML::SAX) >= 0.96 BuildRequires: perl(XML::SAX::Base) BuildRequires: perl(XML::SAX::Writer) >= 0.50 BuildRequires: perl(aliased) BuildRequires: perl(namespace::autoclean) Requires: perl(Bread::Board) Requires: perl(Bread::Board::Container) Requires: perl(Devel::PackagePath) >= 0.01 Requires: perl(Moose) >= 0.92 Requires: perl(Moose::Role) Requires: perl(Moose::Util::TypeConstraints) Requires: perl(MooseX::Aliases) Requires: perl(MooseX::App::Cmd) Requires: perl(MooseX::App::Cmd::Command) Requires: perl(MooseX::Getopt::Dashes) Requires: perl(MooseX::MetaDescription) >= 0.03 Requires: perl(MooseX::MetaDescription::Description) Requires: perl(MooseX::MetaDescription::Meta::Attribute) Requires: perl(MooseX::MetaDescription::Meta::Trait) Requires: perl(MooseX::NonMoose) Requires: perl(MooseX::Types::Path::Class) >= 0.04 Requires: perl(Template) >= 2.20 Requires: perl(XML::SAX) >= 0.96 Requires: perl(XML::SAX::Base) Requires: perl(XML::SAX::Writer) >= 0.50 Requires: perl(aliased) Requires: perl(namespace::autoclean) %{perl_requires} %description XML::Toolkit is a suite of tools that work to make handling XML easier. It is designed to marshall XML documents into Moose classes and back again with minimal changes. For example given a xml document like the following <?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> 'XML::Toolkit' will generate classes for each of the elements. The ' <note' > element's class would be something like package MyApp::Note; use Moose; use namespace::autoclean; use XML::Toolkit; has 'to_collection' => ( isa => 'ArrayRef[MyApp::To]', is => 'ro', init_arg => 'tos', traits => [qw(XML Array)], lazy => 1, auto_deref => 1, default => sub { [] }, handles => { add_to => ['push'] }, description => { Prefix => "", LocalName => "to", node_type => "child", Name => "to", NamespaceURI => "", sort_order => 0, }, ); has 'from_collection' => ( isa => 'ArrayRef[MyApp::From]', is => 'ro', init_arg => 'froms', traits => [qw(XML Array)], lazy => 1, auto_deref => 1, default => sub { [] }, handles => { add_from => ['push'] }, description => { Prefix => "", LocalName => "from", node_type => "child", Name => "from", NamespaceURI => "", sort_order => 1, }, ); has 'body_collection' => ( isa => 'ArrayRef[MyApp::Body]', is => 'ro', init_arg => 'bodys', traits => [qw(XML Array)], lazy => 1, auto_deref => 1, default => sub { [] }, handles => { add_body => ['push'] }, description => { Prefix => "", LocalName => "body", node_type => "child", Name => "body", NamespaceURI => "", sort_order => 2, }, ); has 'heading_collection' => ( isa => 'ArrayRef[MyApp::Heading]', is => 'ro', init_arg => 'headings', traits => [qw(XML Array)], lazy => 1, auto_deref => 1, default => sub { [] }, handles => { add_heading => ['push'] }, description => { Prefix => "", LocalName => "heading", node_type => "child", Name => "heading", NamespaceURI => "", sort_order => 3, }, ); 1; __END__ You can then use the set of classes to load the original document, or create new documents that match this structure. my $document = MyApp::Note->new( to_collection => [MyApp::To->new(text => 'Bob')], from_collection => [MyApp::From->new(text => 'Alice')], headings => [MyApp::Heading->new(text => 'Secret' )], body_collection => [MyApp::Body->new(text=>'Shh!')], ) my $generator = XMLTK::App->new( xmlns => { '' => '' } )->generator; $generator->render_object($root); my $output = join( '', $generator->output ); # output # # <note> # <to>Bob</to> # <from>Alice</from> # <heading>Secret</heading> # <body>Shhh!</body> # </note> The original intention of XML::Toolkit was to round-trip XML documents with an unkonwn schema through an editor and back out to disk with very few semantic or structural changes. %prep %setup -q -n %{cpan_name}-%{version} %build %{__perl} Makefile.PL INSTALLDIRS=vendor %{__make} %{?_smp_mflags} %check %{__make} test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) %doc Changes LICENSE README README.md %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor