Debian Codegraph @

t/12-x2h_ref.t

raw
1 package main;
2 use strict;
3 use warnings;
4
5 use Test::More tests => 2;
6 use Data::Dumper;
7 $Data::Dumper::Indent = 0;
8 $Data::Dumper::Sortkeys = 1;
9
10 use XML::Hash::XS 'xml2hash';
11 $XML::Hash::XS::keep_root = 0;
12
13 our $xml_decl_utf8 = qq{<?xml version="1.0" encoding="utf-8"?>};
14
15 {
16 is
17 Dumper(xml2hash('<root a="abc&#160;def&amp;&apos;&lt;&gt;&quot;"/>', utf8 => 0)),
18 Dumper({ a => "abc\302\240def&\'<>\"" }),
19 'references in the attribute',
20 ;
21 }
22
23 {
24 is
25 xml2hash('<root>&amp;abc&#160;def&amp;&lt;&gt;&quot;&apos;</root>', utf8 => 0),
26 "&abc\302\240def&<>\"'",
27 'references in the content',
28 ;
29 }