Last active
December 24, 2015 00:40
-
-
Save cfedde/6718581 to your computer and use it in GitHub Desktop.
Test case for how I suspect I'll be able to get at the "type=" attribute of this xml frag.
This file contains 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 Modern::Perl; | |
use Mojo::DOM; | |
use Test::More; | |
my $xml = q|<?xml version="1.0" encoding="ISO-8859-1"?> | |
<command type="Error" xmlns="" xmlns:c="C" xsi:type="c:ErrorResponse"><summary>[Error 4007] Invalid login ID: cfedde001c_as01</summary><summaryEnglish>[Error 4007] Invalid login ID: cfedde001c_as01</summaryEnglish></command> | |
|; | |
my $r = Mojo::DOM->new()->xml(1)->parse($xml); | |
ok($r->xml(), "\$r is xml"); | |
ok($r->at('command')->type() eq 'command', "command is a command"); | |
ok($r->at('command')->attr('type') eq "Error", "attr type eq Error"); | |
ok($r->at('command')->type() eq 'command', "command is a command"); | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment