K
kf
Hi,
I'm parsing some relatively complex XML files, but actually only need
to access a couple of the bits of information stored with them.
I thought about coding some kind of parser myself, but am fighting the
urge to persevere with the XML:arser module.
So. I use XML:arser in "Tree" mode to create a big array of arrays of
arrays and then figured I could pass a reference to this array to
something like this:
sub FindObjByName
{
my $name = shift;
my $ref = shift;
if ($ref->[0] eq $name)
{
return $ref->[1];
}
else
{
if ($ref->[0][1])
{
&FindObjByName($name, $ref->[0][1]);
}
else
{
return 0;
}
}
}
But I'm having endless issues getting it to work.
Any help greatly appreciated!
I'm parsing some relatively complex XML files, but actually only need
to access a couple of the bits of information stored with them.
I thought about coding some kind of parser myself, but am fighting the
urge to persevere with the XML:arser module.
So. I use XML:arser in "Tree" mode to create a big array of arrays of
arrays and then figured I could pass a reference to this array to
something like this:
sub FindObjByName
{
my $name = shift;
my $ref = shift;
if ($ref->[0] eq $name)
{
return $ref->[1];
}
else
{
if ($ref->[0][1])
{
&FindObjByName($name, $ref->[0][1]);
}
else
{
return 0;
}
}
}
But I'm having endless issues getting it to work.
Any help greatly appreciated!