|Keep It Simple, Stupid|
|( #3333=superdoc: print w/replies, xml )||Need Help??|
I have a problem with a piece of code using XML::Twig. As I don't seem to be able to access the XML::Twig site at the moment I thought I'd ask for some help from my fellow monks.
I maintain some perl code which uses XML::Twig to run checks on dictionary entries written in XML. One check raises a warning if an entry is labelled as "rare" but also contains more than three example quotations.
The rare label would usually look like this:
For the purposes of the check, the first example is truly rare; the others could be allowed more than three quotes as they were once not-rare. The Perl subroutine which works out whether an entry is to be treated as rare for this check is:
This works correctly for examples 1 (which it treats as "rare") and example 2 (which it treats as "not-rare"), but it treats example 3 as "rare", which is wrong.
I thought that the prev_sibling->text should pick up the bit of text that does match "Now" even though it is not the nearest prev_sibling to the "<la>rare</la>" but that does not seem to be happening. Have I misunderstood how prev_sibling works or is there some other error with this code?
In reply to XML::Twig prev_sibling by mertserger