I need to merge span tags with the same style in the following XML document:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<book>
<p><span style="font-size:10pt;">T</span><span style="font-size:10pt;">h</span><span style="font-size:10pt;">e</span></p>
<p><span style="font-style:italic;">o</span><span style="font-style:italic;">f</span><span style="font-size:10pt;">e</span></p>
</book>
My desired output is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<book>
<p><span style="font-size:10pt;">The</span></p>
<p><span style="font-style:italic;">of</span><span style="font-size:10pt;">e</span></p>
</book>
This is what I have tried so far:
use strict;
use XML::Twig;
my $Document = XML::Twig->new(
keep_encoding=>1,
twig_handlers =>{
},
pretty_print => 'indented',
);
$Document->parsefile("book.xml");
$Document->print();
I am having difficulty understanding the concepts of this module. Is what I am trying to do possible?
Aucun commentaire:
Enregistrer un commentaire