[libxml2] Fixes for xmlInitParserCtxt
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fixes for xmlInitParserCtxt
- Date: Wed, 11 Jun 2014 09:01:05 +0000 (UTC)
commit c35af8b18dddd0bdfb137ad6a056837a3d5ea651
Author: Daniel Veillard <veillard redhat com>
Date: Wed Jun 11 16:59:16 2014 +0800
Fixes for xmlInitParserCtxt
let's make sure that parser options are updated too when a corrsponding
global variable or other field of the context is set.
parserInternals.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/parserInternals.c b/parserInternals.c
index 98a5836..df204fd 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -1691,12 +1691,20 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->nsWellFormed = 1;
ctxt->valid = 1;
ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
+ if (ctxt->loadsubset) {
+ ctxt->options |= XML_PARSE_DTDLOAD;
+ }
ctxt->validate = xmlDoValidityCheckingDefaultValue;
ctxt->pedantic = xmlPedanticParserDefaultValue;
+ if (ctxt->pedantic) {
+ ctxt->options |= XML_PARSE_PEDANTIC;
+ }
ctxt->linenumbers = xmlLineNumbersDefaultValue;
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
- if (ctxt->keepBlanks == 0)
+ if (ctxt->keepBlanks == 0) {
ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
+ ctxt->options |= XML_PARSE_NOBLANKS;
+ }
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0;
ctxt->vctxt.userData = ctxt;
@@ -1708,8 +1716,12 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
else
ctxt->vctxt.warning = xmlParserValidityWarning;
ctxt->vctxt.nodeMax = 0;
+ ctxt->options |= XML_PARSE_DTDVALID;
}
ctxt->replaceEntities = xmlSubstituteEntitiesDefaultValue;
+ if (ctxt->replaceEntities) {
+ ctxt->options |= XML_PARSE_NOENT;
+ }
ctxt->record_info = 0;
ctxt->nbChars = 0;
ctxt->checkIndex = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]