summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-07-23 19:39:43 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-07-23 19:39:43 +0000
commitd9bad13bb2d5894eb03f0cd36d26fffa81dd6f47 (patch)
treeadd99437b767b61b6713bf2f00467dcb00c0f0fb
parentf012a64d13d85d53eac0d4d6625508109e7c9e9d (diff)
downloadlibxml2-d9bad13bb2d5894eb03f0cd36d26fffa81dd6f47.tar.gz
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
-rw-r--r--ChangeLog8
-rw-r--r--SAX.c6
-rw-r--r--include/libxml/parser.h2
-rw-r--r--parser.c19
-rw-r--r--parserInternals.c1
-rw-r--r--result/scripts/base13
-rw-r--r--result/scripts/base213
-rw-r--r--xmllint.c1
8 files changed, 43 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 226c6f0b..d1dab2b0 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 425b374e..6789f433 100644
--- a/SAX.c
+++ b/SAX.c
@@ -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.
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index fdfb75fb..b87d9729 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -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
diff --git a/parser.c b/parser.c
index 108bd737..5af7035f 100644
--- a/parser.c
+++ b/parser.c
@@ -93,6 +93,7 @@ int xmlDoValidityCheckingDefaultValue = 0;
#endif
int xmlLoadExtDtdDefaultValue = 0;
int xmlPedanticParserDefaultValue = 0;
+int xmlLineNumbersDefaultValue = 0;
int xmlKeepBlanksDefaultValue = 1;
/*
@@ -10122,6 +10123,24 @@ xmlPedanticParserDefault(int val) {
}
/**
+ * 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 022a994b..6eeae3db 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -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) {
diff --git a/result/scripts/base b/result/scripts/base
index bdfed189..f64231a5 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 ba8bf64f..93edf376 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 cce235b7..618db945 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -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;