in reply to Get errors and line no's while parsing XML file
What do you get if you inspect $@ in case an error is thrown? (IIRC, the error messages do include line number information.)
Update: for example, when I add the line
print $@ if $@;
to your code snippet, and with a sample.xml containing
<?xml version="1.0" encoding="UTF-8"?> <mydoc> <foo> <bar>... </bar_> </foo> </mydoc>
I do get:
$ ./840913.pl sample.xml:5: parser error : expected '>' </bar_> ^ at ./840913.pl line 11
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |