There are freely available, tiny, pure Perl XML parsers available. These are small enough you could copy paste them into your Perl program.
The tiniest one (less than 50 lines) returns a list of parsed elements. From the list, you can find the first occurrence of RemoteHost, then find the hostname, synopsis and other elements you want and extract their values. Then find the /RemoteHost element, then find the next RemoteHost element, find and extract the subelement, finally, repeat until end of file reached.
This one is at http://www.cs.sfu.ca/~cameron/REX.html#AppA in appendix A.
The other is actually the module XML::Parser::Lite and is based on the above parser. It's a little easier to use than the "bare" parser. The module is small enough you could copy/paste it into your Perl program. It does not have to be its own package, or you can do package main; after the end of XML::Parser::Lite
HOWEVER, you can not use regular expressions - or even split - in your call back functions when using XML::Parser::Lite because the callbacks are being called by Perls regex engine. However, you should not need to use regular expressions or split as the element names given to the callbacks can be directly compared (using eq) to scalar values and the element values are cleanly extracted.
In reply to Re: No tools? Use Perl?!
by RonW
in thread No tools? Use Perl?!
by Boyd.Ako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |