ajt has asked for the wisdom of the Perl Monks concerning the following question:
I would like my script (built round CGI) to give the user an error if the file isn't a well formed XML one. I've checked that the file is more than zero bytes already.
I don't want to check for validity (I can't anyway), I just want to quickly be able to emit an error message to the user's browser, and die.
I assume that if I simply open up the file in an XML parser, and it doesn't die when I parse it, then it's XML and well-formed, which should be enough to pass the file on to another process.
Q1 Is this a sensible approach?
Q2 If it is, which module is fastest and simplest? I don't plan to actually do anything with the file. Just do a HTTP POST to another server.
As ever, many thanks in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is a file XML?
by davorg (Chancellor) on Sep 25, 2001 at 15:23 UTC | |
|
Re: Is a file XML?
by mirod (Canon) on Sep 25, 2001 at 15:40 UTC | |
|
Re: Is a file XML?
by Caillte (Friar) on Sep 25, 2001 at 15:26 UTC | |
by davorg (Chancellor) on Sep 25, 2001 at 15:34 UTC |