Created
December 10, 2010 13:04
-
-
Save sharifulin/736180 to your computer and use it in GitHub Desktop.
Mojo::DOM and bug with tag case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use lib 'lib'; | |
use ojo; | |
use Test::More tests => 4; | |
my $xml = do { local $/; <DATA> }; | |
my $x = x($xml); | |
is $xml, $x->to_xml, 'XMLs are eq'; | |
# is $x->at('DCSubtitle')->attrs->{Version}, '1.0', 'First DCSubtitle'; # don't work | |
# is $x->at('Subtitle')->attrs->{SpotNumber}, 1, 'First Subtitle'; # don't work | |
is $x->at( 'subtitle')->attrs->{SpotNumber}, 1, 'First Subtitle 2'; # wrong case # error | |
is $x->at('font subtitle')->attrs->{SpotNumber}, 1, 'First Subtitle 3'; # wrong case # ok | |
is $x->at('font')->attrs->{Color}, 'FFFFFFFF', 'First Font'; # wrong case | |
__DATA__ | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<DCSubtitle Version="1.0"> | |
<SubtitleID>GPCC2976-759A-4D71-A5D3-DC343F701F81</SubtitleID> | |
<MovieTitle>PYRANHA</MovieTitle> | |
<ReelNumber>1</ReelNumber> | |
<Language>Lithuanian</Language> | |
<LoadFont Id="Font1" URI="p1.ttf" /> | |
<Font Id="Font1" Color="FFFFFFFF" Effect="border" EffectColor="FF000000" Size="35" Weight="normal"> | |
<Subtitle SpotNumber="1" TimeIn="00:00:28:04" TimeOut="00:00:30:02"> | |
<Text VAlign="bottom" HAlign="center" VPosition="9" HPosition="0">STOP</Text> | |
</Subtitle> | |
<Subtitle SpotNumber="2" TimeIn="00:00:38:04" TimeOut="00:00:40:02"> | |
<Text VAlign="bottom" HAlign="center" VPosition="9" HPosition="0">STOP 2</Text> | |
</Subtitle> | |
</Font> | |
</DCSubtitle> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment