Commit f6bad798 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

make sure xmllint --stream and xmllint --stream --valid returns errors

* xmllint.c xmlreader.c include/libxml/xmlreader.h: make sure
  xmllint --stream and xmllint --stream --valid returns errors
  code appropriately
Daniel
parent c6cae7b6
Fri Apr 11 21:36:21 CEST 2003 Daniel Veillard <daniel@veillard.com>
* xmllint.c xmlreader.c include/libxml/xmlreader.h: make sure
xmllint --stream and xmllint --stream --valid returns errors
code appropriately
Fri Apr 11 10:59:24 CEST 2003 Daniel Veillard <daniel@veillard.com>
 
* xmlreader.c include/libxml/xmlreader.h: Added the Expand()
......
......@@ -108,6 +108,7 @@ xmlNodePtr xmlTextReaderCurrentNode (xmlTextReaderPtr reader);
xmlDocPtr xmlTextReaderCurrentDoc (xmlTextReaderPtr reader);
xmlNodePtr xmlTextReaderExpand (xmlTextReaderPtr reader);
int xmlTextReaderNext (xmlTextReaderPtr reader);
int xmlTextReaderIsValid (xmlTextReaderPtr reader);
/*
* Error handling extensions
......
......@@ -635,15 +635,24 @@ static void streamFile(char *filename) {
ret = xmlTextReaderRead(reader);
}
if (valid) {
if (xmlTextReaderIsValid(reader) != 1) {
xmlGenericError(xmlGenericErrorContext,
"Document %s does not validate\n", filename);
progresult = 3;
}
}
/*
* Done, cleanup and status
*/
xmlFreeTextReader(reader);
if (ret != 0) {
printf("%s : failed to parse\n", filename);
progresult = 1;
}
} else {
fprintf(stderr, "Unable to open %s\n", filename);
progresult = 1;
}
}
......
......@@ -2611,6 +2611,20 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
}
}
/**
* xmlTextReaderIsValid:
* @reader: the xmlTextReaderPtr used
*
* Retrieve the validity status from the parser context
*
* Returns the flag value 1 if valid, 0 if no, and -1 in case of error
*/
int
xmlTextReaderIsValid(xmlTextReaderPtr reader) {
if ((reader == NULL) || (reader->ctxt == NULL)) return(-1);
return(reader->ctxt->valid);
}
/**
* xmlTextReaderGetErrorHandler:
* @reader: the xmlTextReaderPtr used
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment