[xml] Handling of parser errors

Date view Thread view Subject view Author view

From: Georg C. F. Greve (greve@gnu.org)
Date: Thu Apr 20 2000 - 06:09:52 EDT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I'm currently worming my way into the libxml for a project and noticed
something that is a little annoying. When the XML file contains
errors these are printed directly on stdout/stderr - but for a program
that does not have a stdout/stderr at the time when XML is being
parsed this is highly undesireable. But I would still prefer not to
use the SAX interface, if possible.

What I would probably consider the best solution is a 0 return value
of xmlParseFile upon errors in the XML code and then a

  char** xmlParseErrors(const char* filename);
  void xmlFreeParseErrors(const char* filename);

pair of functions where filename is the name of the file that has been
read and the return value of xmlParseErrors is the address of a 0
terminated list of pointers to the 0 terminated c-style strings that
contain the error messages. The xmlFreeParseErrors would release the
memory taken up by the error messages for this file.

That way the calling program could deal with the error messages in the
best way while all information about the incorrect XML is preserved.

Just my 2c...

Regards,
                Georg

- --
Georg C. F. Greve <greve@gnu.org>
the monthly GNU forum in English, German,
French, Spanish and Japanese. Check it out
at http://www.gnu.org/brave-gnu-world/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.0 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.4 and Gnu Privacy Guard <http://www.gnupg.org/>

iD8DBQE4/tdvbvivwoZXSsoRApHlAKC/Oxa7osl+B647ogCe7Y6/fiNyZwCfflxo
LnK4GZw49NZCNQ8AwLUJMbQ=
=4Hkq
-----END PGP SIGNATURE-----

----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:30:11 EDT