Re: [xml] Exit code of xmllint always 0?
- From: "Fischer, Oliver" <plexus snafu de>
- To: veillard redhat com
- Cc: xml gnome org
- Subject: Re: [xml] Exit code of xmllint always 0?
- Date: Thu, 19 Dec 2002 09:17:45 +0100
Hello Daniel,
I tried the patch against libxml2-2.4.30.tar.gz and now it
returns 4 instead of 0 if xmllint finds errors.
Thanks!
Bye
Oliver
Daniel Veillard wrote:
On Wed, Dec 18, 2002 at 09:35:26PM +0100, Fischer, Oliver wrote:
But one small thing bothers me: It seems, that xmllint always
exits with 0 even if the document not fits the DTD.
Is there a way that it returns in this case another value then 0
to signal a failure? Would be usefull for my ant and makefiles.
Can you try the enclosed patch ? Untested yet,
Daniel
------------------------------------------------------------------------
Index: xmllint.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmllint.c,v
retrieving revision 1.63
diff -c -r1.63 xmllint.c
*** xmllint.c 10 Dec 2002 15:19:07 -0000 1.63
--- xmllint.c 18 Dec 2002 21:14:33 -0000
***************
*** 743,750 ****
doc = xmlParseMemory((char *) base, info.st_size);
munmap((char *) base, info.st_size);
#endif
! } else
doc = xmlParseFile(filename);
}
/*
--- 743,771 ----
doc = xmlParseMemory((char *) base, info.st_size);
munmap((char *) base, info.st_size);
#endif
! } else if (valid) {
! int ret;
! xmlParserCtxtPtr ctxt;
!
! ctxt = xmlCreateFileParserCtxt(filename);
!
! if (ctxt == NULL) {
! doc = NULL;
! } else {
! xmlParseDocument(ctxt);
! if (ctxt->valid == 0)
! progresult = 4;
! ret = ctxt->wellFormed;
! doc = ctxt->myDoc;
! xmlFreeParserCtxt(ctxt);
! if (!ret) {
! xmlFreeDoc(doc);
! doc = NULL;
! }
! }
! } else {
doc = xmlParseFile(filename);
+ }
}
/*
--
Oliver Fischer - plexus[AT]snafu[DOT]de
[de] Das Internet stammt aus dem letzten Jahrtausend!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]