NAME
WWW::Bund::Response::XML - XML response — parses content to Perl data structure via XML::Twig
VERSION
version 0.001
SYNOPSIS
use WWW::Bund::Response::XML;
my $response = WWW::Bund::Response::XML->new(
content => '<root><item>value</item></root>',
content_type => 'application/xml',
);
my $data = $response->data; # { item => 'value' }
DESCRIPTION
Parses XML response content into Perl HashRef using XML::Twig.
XML elements are converted to HashRef with the following rules:
Element attributes become hash keys
Repeated child elements become ArrayRef
Unique child elements become hash keys
Leaf elements with only text become scalar values
Leaf elements with both attributes and text store text as
_text
Handles UTF-8 encoding correctly: if content is a Perl character string, it is encoded to bytes before parsing (XML::Parser requires bytes).
Used by Bundestag and Bundesrat APIs which return XML instead of JSON.
data
Parsed XML as HashRef. Lazy-built from content.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-bund/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.