removing history/readline changed this slightly make element content line

* result/scripts/base*: removing history/readline changed
  this slightly
* include/libxml/parser.h SAX.c parser.c parserInternals.c
  xmllint.c: make element content line number generation
  optionnal to avoid breaking old apps added interface to switch
Daniel
This commit is contained in:
Daniel Veillard 2001-07-23 19:39:43 +00:00
parent f012a64d13
commit d9bad13bb2
8 changed files with 43 additions and 20 deletions

View File

@ -1,3 +1,11 @@
Tue Jul 24 15:39:11 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* result/scripts/base*: removing history/readline changed
this slightly
* include/libxml/parser.h SAX.c parser.c parserInternals.c
xmllint.c: make element content line number generation
optionnal to avoid breaking old apps added interface to switch
Tue Jul 24 15:06:58 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* configure.in: get rid of the readline and libhistory

6
SAX.c
View File

@ -966,8 +966,10 @@ startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
parent = ctxt->myDoc->children;
}
ctxt->nodemem = -1;
if (ctxt->input != NULL)
ret->content = (void *) (long) ctxt->input->line;
if (ctxt->linenumbers) {
if (ctxt->input != NULL)
ret->content = (void *) (long) ctxt->input->line;
}
/*
* We are parsing a new node.

View File

@ -216,6 +216,7 @@ struct _xmlParserCtxt {
void *_private; /* For user data, libxml won't touch it */
int loadsubset; /* should the external subset be loaded */
int linenumbers; /* set line number in element content */
};
/**
@ -422,6 +423,7 @@ int xmlSubstituteEntitiesDefault(int val);
int xmlKeepBlanksDefault (int val);
void xmlStopParser (xmlParserCtxtPtr ctxt);
int xmlPedanticParserDefault(int val);
int xmlLineNumbersDefault (int val);
/*
* Recovery mode

View File

@ -93,6 +93,7 @@ int xmlDoValidityCheckingDefaultValue = 0;
#endif
int xmlLoadExtDtdDefaultValue = 0;
int xmlPedanticParserDefaultValue = 0;
int xmlLineNumbersDefaultValue = 0;
int xmlKeepBlanksDefaultValue = 1;
/*
@ -10121,6 +10122,24 @@ xmlPedanticParserDefault(int val) {
return(old);
}
/**
* xmlLineNumbersDefault:
* @val: int 0 or 1
*
* Set and return the previous value for enabling line numbers in elements
* contents. This may break on old application and is turned off by default.
*
* Returns the last value for 0 for no substitution, 1 for substitution.
*/
int
xmlLineNumbersDefault(int val) {
int old = xmlLineNumbersDefaultValue;
xmlLineNumbersDefaultValue = val;
return(old);
}
/**
* xmlSubstituteEntitiesDefault:
* @val: int 0 or 1

View File

@ -2230,6 +2230,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
ctxt->validate = xmlDoValidityCheckingDefaultValue;
ctxt->pedantic = xmlPedanticParserDefaultValue;
ctxt->linenumbers = xmlPedanticParserDefaultValue;
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
ctxt->vctxt.userData = ctxt;
if (ctxt->validate) {

View File

@ -1,9 +1,4 @@
/ > base
./test/scripts/base.xml
/ > cd //e
e > base
http://example.com/base/
e > cd .//img
img > base
http://example.com/base/images/
img > exit
/ > ./test/scripts/base.xml
/ > e > http://example.com/base/
e > img > http://example.com/base/images/
img >

View File

@ -1,9 +1,4 @@
/ > base
./test/scripts/base2.xml
/ > cd //e
e > base
test/scripts/html/
e > cd .//img
img > base
test/scripts/images/
img > exit
/ > ./test/scripts/base2.xml
/ > e > test/scripts/html/
e > img > test/scripts/images/
img >

View File

@ -954,6 +954,7 @@ main(int argc, char **argv) {
return(1);
}
}
xmlLineNumbersDefault(1);
if (loaddtd != 0) xmlLoadExtDtdDefaultValue = 6; /* fetch DTDs by default */
if (noent != 0) xmlSubstituteEntitiesDefault(1);
if (valid != 0) xmlDoValidityCheckingDefaultValue = 1;