http://www.perlmonks.org?node_id=901781


in reply to XML::Twig and handles on regex/xpath

As a general note on working with xpath: it pays off to use a decent XML editor. They support interactively constructing xpath expressions and validate them on the fly. You continuously see the results returned by the expression. In my experience this saves a lot of time debugging:) Before you use the expression in your script you have validated that it's correct. In your example it reports syntax errors e.g. 'XPath syntax error at char 25 in ... Unexpected token "<numeric literal>" after axis name'. While you could still argue that the message could be improved, it's better then the "unrecongnised expression in handler" message. I recommend you to take a look at oXygen or XMLspy. They can ease your "xml-life" considerably (try debugging a xslt!). (There are many free/open source XML editors available but IMHO none of them even comes close to the commercial ones.)

Cheers

Harry

  • Comment on Re: XML::Twig and handles on regex/xpath

Replies are listed 'Best First'.
Re^2: XML::Twig and handles on regex/xpath
by Eythil (Acolyte) on Apr 28, 2011 at 11:27 UTC
    So far I've been using vim to look at my xml files.
    But I have to admit that it might not be the best tool to look at these files.

    I haven't looked at any plugins for it (if there are any) that would report syntax errors, but that might be a good idea.