From 50abdc0ac4c34c03aeabee19e8175030d40a8e40 Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Tue, 2 May 2023 18:19:32 +0200 Subject: [PATCH] Changing LibXML to Twig. --- Build.PL | 2 +- lib/BurguillosInfo/Controller/Sitemap.pm | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Build.PL b/Build.PL index 20df077..5112d1c 100755 --- a/Build.PL +++ b/Build.PL @@ -18,7 +18,7 @@ my $build = Module::Build->new( 'DateTime::Format::ISO8601.pm' => 0, 'DateTime::Format::Mail.pm' => 0, 'SVG' => 0, - 'XML::LibXML::PrettyPrint' => 0, + 'XML::Twig' => 0, }, ); $build->create_build_script; diff --git a/lib/BurguillosInfo/Controller/Sitemap.pm b/lib/BurguillosInfo/Controller/Sitemap.pm index 7f8d6fd..f44a242 100644 --- a/lib/BurguillosInfo/Controller/Sitemap.pm +++ b/lib/BurguillosInfo/Controller/Sitemap.pm @@ -10,8 +10,7 @@ use BurguillosInfo::Posts; use DateTime::Format::ISO8601; -use XML::LibXML; -use XML::LibXML::PrettyPrint; +use XML::Twig; use Mojo::Base 'Mojolicious::Controller', '-signatures'; @@ -27,10 +26,8 @@ sub sitemap ($self) { $self->_append_category_dom( $dom, $category_key, $categories ); } my $xml_string = "$dom"; - my $document = XML::LibXML->load_xml(string => $xml_string); - my $pretty_print = XML::LibXML::PrettyPrint->new(indent_string => (" " x 4)); - $pretty_print->pretty_print($document); - $xml_string = $document->toString(); + my $document = XML::Twig->new(pretty_print=> 'indented'); + $xml_string = $document->parse($xml_string)->sprint; $self->render(text => $xml_string, format => 'xml'); }