Files
perl-XML-Parser-Lite-Tree/perl-XML-Parser-Lite-Tree.spec
2025-08-12 18:18:38 +02:00

102 lines
3.5 KiB
RPMSpec

#
# spec file for package perl-XML-Parser-Lite-Tree
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define cpan_name XML-Parser-Lite-Tree
Name: perl-XML-Parser-Lite-Tree
Version: 0.140.0
Release: 0
# 0.14 -> normalize -> 0.140.0
%define cpan_version 0.14
License: CHECK(Artistic-1.0 or GPL-1.0-or-later)
Summary: Lightweight XML tree builder
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/I/IA/IAMCAL/%{cpan_name}-%{cpan_version}.tar.gz
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
Provides: perl(XML::Parser::Lite::Tree) = %{version}
Provides: perl(XML::Parser::LiteCopy) = 0.720.0
%undefine __perllib_provides
%{perl_requires}
%description
This is a singleton class for parsing XML into a tree structure. How does
this differ from other XML tree generators? By using XML::Parser::Lite,
which is a pure perl XML parser. Using this module you can tree-ify simple
XML without having to compile any C.
For example, the following XML:
<foo woo="yay"><bar a="b" c="d" />hoopla</foo>
Parses into the following tree:
'children' => [
{
'children' => [
{
'children' => [],
'attributes' => {
'a' => 'b',
'c' => 'd'
},
'type' => 'element',
'name' => 'bar'
},
{
'content' => 'hoopla',
'type' => 'text'
}
],
'attributes' => {
'woo' => 'yay'
},
'type' => 'element',
'name' => 'foo'
}
],
'type' => 'root'
};
Each node contains a 'type' key, one of 'root', 'element' and 'text'.
'root' is the document root, and only contains an array ref 'children'.
'element' represents a normal tag, and contains an array ref 'children', a
hash ref 'attributes' and a string 'name'. 'text' nodes contain only a
'content' string.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc README
%changelog