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
diff --git a/ChangeLog b/ChangeLog
index 226c6f0..d1dab2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/SAX.c b/SAX.c
index 425b374..6789f43 100644
--- a/SAX.c
+++ b/SAX.c
@@ -966,8 +966,10 @@
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.
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index fdfb75f..b87d972 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -216,6 +216,7 @@
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 xmlKeepBlanksDefault (int val);
void xmlStopParser (xmlParserCtxtPtr ctxt);
int xmlPedanticParserDefault(int val);
+int xmlLineNumbersDefault (int val);
/*
* Recovery mode
diff --git a/parser.c b/parser.c
index 108bd73..5af7035 100644
--- a/parser.c
+++ b/parser.c
@@ -93,6 +93,7 @@
#endif
int xmlLoadExtDtdDefaultValue = 0;
int xmlPedanticParserDefaultValue = 0;
+int xmlLineNumbersDefaultValue = 0;
int xmlKeepBlanksDefaultValue = 1;
/*
@@ -10122,6 +10123,24 @@
}
/**
+ * 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
*
diff --git a/parserInternals.c b/parserInternals.c
index 022a994..6eeae3d 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -2230,6 +2230,7 @@
ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
ctxt->validate = xmlDoValidityCheckingDefaultValue;
ctxt->pedantic = xmlPedanticParserDefaultValue;
+ ctxt->linenumbers = xmlPedanticParserDefaultValue;
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
ctxt->vctxt.userData = ctxt;
if (ctxt->validate) {
diff --git a/result/scripts/base b/result/scripts/base
index bdfed18..f64231a 100644
--- a/result/scripts/base
+++ b/result/scripts/base
@@ -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 >
\ No newline at end of file
diff --git a/result/scripts/base2 b/result/scripts/base2
index ba8bf64..93edf37 100644
--- a/result/scripts/base2
+++ b/result/scripts/base2
@@ -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 >
\ No newline at end of file
diff --git a/xmllint.c b/xmllint.c
index cce235b..618db94 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -954,6 +954,7 @@
return(1);
}
}
+ xmlLineNumbersDefault(1);
if (loaddtd != 0) xmlLoadExtDtdDefaultValue = 6; /* fetch DTDs by default */
if (noent != 0) xmlSubstituteEntitiesDefault(1);
if (valid != 0) xmlDoValidityCheckingDefaultValue = 1;