4 #my $root= $node->root;
6 # get the XML declaration first (need pis to be stored)
7 if( my $xml_decl= first { $_->{_tag} eq '~pi' } $root->content_list)
8 { if( $xml_decl->{text}=~ m{encoding\s*=\s*(["'])(.*?)\1})
9 { $charset->{declaration}= $2; }
12 if( my $head= first { lc( $_->{_tag}) eq 'head' } $root->content_list)
13 { if( my $meta= first { lc( $_->{_tag}) eq 'meta' && lc( $_->{http-equiv}) eq "content-type") }
16 { if( $meta->{content} && lc( $meta->{content})=~ m{charset\s*=\s*([\w-]*))
17 { charset->{meta}= $1; }