ASX parser module?

A

arz

Hi,

I need an ASX link checker script that parses ASX media description
files and checks whether the resulting links point to valid media
streams.

Searching at CPAN, it seems that there are some modules available for
creating ASX files, but not for parsing. So I was wondering is there
anything specifically available for parsing ASX or do I just need to
use any of the XML::* modules?

XML::Simple would seem good enough with the least amount of code, only
I guess the associative array will have case-insensitive keys, because
the ASX is case-insensitive, so the values will not be directly
addressable, and I'll have to iterate over the keys each time to find
which case is used...

Any other suggestion welcome.

Thanks,
Arnoud.
 
M

Michele Dondi

Searching at CPAN, it seems that there are some modules available for
creating ASX files, but not for parsing. So I was wondering is there
anything specifically available for parsing ASX or do I just need to
use any of the XML::* modules?

AIUI any XML parsing module would do.
XML::Simple would seem good enough with the least amount of code, only

I second that.
I guess the associative array will have case-insensitive keys, because
the ASX is case-insensitive, so the values will not be directly
addressable, and I'll have to iterate over the keys each time to find
which case is used...

Nope, keys are strings, and as such *are* case sensitive. You have to
deal with ASX's case insensitiveness yourself. Doesn't seem a hard
task.


Michele
 
M

Michele Dondi

Another relatively straight forward way would be with XML::TreeBuilder.
Instead of addressing hash keys you'd do something like

Thanks, I have used H::T but didn't know X::T (although I may have
guessed) and for all of my XML stuff, since I'm really a noob at that
and don't have particular "performance" requirements, I use X::S. Now,
this is of course good news!


Michele
 
A

arz

Another relatively straight forward way would be with XML::TreeBuilder.
Instead of addressing hash keys you'd do something like

my $tree = XML::TreeBuilder->new;
$tree->parse_file('example.asx');

for my $entry ( $tree->look_down('_tag', 'entry' ) )
{
my $ref = $entry->look_down('_tag', 'ref');
if( $ref && $ref->attr('href') && validstream( $ref->attr('href') ) )
...

}

IMHO not too much typing overhead to get case-insensitive tag matching.

-Chris

Thanks! This looks like what I need. Now I only need case checking for
'href' as an attribute, but all mixed-case tags are covered.
Straightforward indeed.

Arnoud.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top