mirror of
https://github.com/GNOME/libxml2.git
synced 2025-02-11 18:09:31 +08:00
Fixed #6766 and satrted working on white space handling, Daniel
This commit is contained in:
parent
88f00ae133
commit
83a30e7a16
@ -1,3 +1,10 @@
|
||||
Thu Mar 2 02:26:13 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||
|
||||
* parser.c: tried to remove the <a> </a> generating <a/>
|
||||
this is hard. Left a flag for that purpose. Fixed bug #6766
|
||||
* configure.in: prepared 1.8.7 not released, due to previous
|
||||
problem
|
||||
|
||||
Thu Mar 2 03:03:50 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||
|
||||
* doc/xml.html : applied second patch from Paul DuBois
|
||||
|
@ -256,8 +256,6 @@ confexec_DATA = xmlConf.sh
|
||||
|
||||
CLEANFILES=xmlConf.sh
|
||||
|
||||
EXTRA_DIST = xmlConf.sh.in
|
||||
|
||||
confexecdir=$(libdir)
|
||||
confexec_DATA = xmlConf.sh
|
||||
EXTRA_DIST = xmlConf.sh.in libxml.spec.in libxml.spec \
|
||||
|
@ -5,7 +5,7 @@ AM_CONFIG_HEADER(config.h)
|
||||
|
||||
LIBXML_MAJOR_VERSION=1
|
||||
LIBXML_MINOR_VERSION=8
|
||||
LIBXML_MICRO_VERSION=6
|
||||
LIBXML_MICRO_VERSION=7
|
||||
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
|
||||
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
|
||||
|
||||
|
@ -159,6 +159,7 @@ struct _xmlParserCtxt {
|
||||
|
||||
long nbChars; /* number of xmlChar processed */
|
||||
long checkIndex; /* used by progressive parsing lookup */
|
||||
int keepBlanks; /* ugly but ... */
|
||||
};
|
||||
|
||||
/**
|
||||
|
29
parser.c
29
parser.c
@ -263,6 +263,7 @@ xmlParserInputShrink(xmlParserInputPtr in) {
|
||||
|
||||
int xmlSubstituteEntitiesDefaultValue = 0;
|
||||
int xmlDoValidityCheckingDefaultValue = 0;
|
||||
int xmlKeepBlanksDefaultValue = 0;
|
||||
xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt,
|
||||
const xmlChar ** str);
|
||||
|
||||
@ -684,6 +685,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
|
||||
ctxt->wellFormed = 1;
|
||||
ctxt->valid = 1;
|
||||
ctxt->validate = xmlDoValidityCheckingDefaultValue;
|
||||
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
|
||||
ctxt->vctxt.userData = ctxt;
|
||||
if (ctxt->validate) {
|
||||
ctxt->vctxt.error = xmlParserValidityError;
|
||||
@ -2077,27 +2079,37 @@ static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
|
||||
int i, ret;
|
||||
xmlNodePtr lastChild;
|
||||
|
||||
/*
|
||||
* Check that the string is made of blanks
|
||||
*/
|
||||
for (i = 0;i < len;i++)
|
||||
if (!(IS_BLANK(str[i]))) return(0);
|
||||
|
||||
if (CUR != '<') return(0);
|
||||
if (ctxt->node == NULL) return(0);
|
||||
/*
|
||||
* Look if the element is mixed content in the Dtd if available
|
||||
*/
|
||||
if (ctxt->myDoc != NULL) {
|
||||
ret = xmlIsMixedElement(ctxt->myDoc, ctxt->node->name);
|
||||
if (ret == 0) return(1);
|
||||
if (ret == 1) return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* heuristic
|
||||
* Do we allow an heuristic on white space
|
||||
*/
|
||||
if (ctxt->keepBlanks)
|
||||
return(0);
|
||||
if (CUR != '<') return(0);
|
||||
if (ctxt->node == NULL) return(0);
|
||||
|
||||
lastChild = xmlGetLastChild(ctxt->node);
|
||||
if (lastChild == NULL) {
|
||||
if (ctxt->node->content != NULL) return(0);
|
||||
if (ctxt->node->content != NULL) return(0);
|
||||
} else if (xmlNodeIsText(lastChild))
|
||||
return(0);
|
||||
return(0);
|
||||
else if ((ctxt->node->childs != NULL) &&
|
||||
(xmlNodeIsText(ctxt->node->childs)))
|
||||
return(0);
|
||||
(xmlNodeIsText(ctxt->node->childs)))
|
||||
return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@ -8319,7 +8331,8 @@ xmlCreateMemoryParserCtxt(char *buffer, int size) {
|
||||
xmlParserInputPtr input;
|
||||
xmlCharEncoding enc;
|
||||
|
||||
buffer[size - 1] = '\0';
|
||||
if (buffer[size] != '\0')
|
||||
buffer[size] = '\0';
|
||||
|
||||
ctxt = xmlNewParserCtxt();
|
||||
if (ctxt == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user