mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
fixed the xmlLineNumbersDefault() errors, lesson don't add new functions
* parser.c parserInternals.c: fixed the xmlLineNumbersDefault() errors, lesson don't add new functions at 1am before a release * xpath.c: integrated fix from Bjorn to avoid divide by zero from XPath initialization when possible. Daniel
This commit is contained in:
@ -49,6 +49,24 @@
|
||||
|
||||
void xmlUpgradeOldNs(xmlDocPtr doc);
|
||||
|
||||
/*
|
||||
* Various global defaults for parsing
|
||||
*/
|
||||
int xmlGetWarningsDefaultValue = 1;
|
||||
#ifdef VMS
|
||||
int xmlSubstituteEntitiesDefaultVal = 0;
|
||||
#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal
|
||||
int xmlDoValidityCheckingDefaultVal = 0;
|
||||
#define xmlDoValidityCheckingDefaultValue xmlDoValidityCheckingDefaultVal
|
||||
#else
|
||||
int xmlSubstituteEntitiesDefaultValue = 0;
|
||||
int xmlDoValidityCheckingDefaultValue = 0;
|
||||
#endif
|
||||
int xmlLoadExtDtdDefaultValue = 0;
|
||||
int xmlPedanticParserDefaultValue = 0;
|
||||
int xmlLineNumbersDefaultValue = 0;
|
||||
int xmlKeepBlanksDefaultValue = 1;
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Version and Features handling *
|
||||
@ -2230,7 +2248,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
|
||||
ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
|
||||
ctxt->validate = xmlDoValidityCheckingDefaultValue;
|
||||
ctxt->pedantic = xmlPedanticParserDefaultValue;
|
||||
ctxt->linenumbers = xmlPedanticParserDefaultValue;
|
||||
ctxt->linenumbers = xmlLineNumbersDefaultValue;
|
||||
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
|
||||
ctxt->vctxt.userData = ctxt;
|
||||
if (ctxt->validate) {
|
||||
@ -2488,6 +2506,101 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Defaults settings *
|
||||
* *
|
||||
************************************************************************/
|
||||
/**
|
||||
* xmlPedanticParserDefault:
|
||||
* @val: int 0 or 1
|
||||
*
|
||||
* Set and return the previous value for enabling pedantic warnings.
|
||||
*
|
||||
* Returns the last value for 0 for no substitution, 1 for substitution.
|
||||
*/
|
||||
|
||||
int
|
||||
xmlPedanticParserDefault(int val) {
|
||||
int old = xmlPedanticParserDefaultValue;
|
||||
|
||||
xmlPedanticParserDefaultValue = 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
|
||||
*
|
||||
* Set and return the previous value for default entity support.
|
||||
* Initially the parser always keep entity references instead of substituting
|
||||
* entity values in the output. This function has to be used to change the
|
||||
* default parser behaviour
|
||||
* SAX::subtituteEntities() has to be used for changing that on a file by
|
||||
* file basis.
|
||||
*
|
||||
* Returns the last value for 0 for no substitution, 1 for substitution.
|
||||
*/
|
||||
|
||||
int
|
||||
xmlSubstituteEntitiesDefault(int val) {
|
||||
int old = xmlSubstituteEntitiesDefaultValue;
|
||||
|
||||
xmlSubstituteEntitiesDefaultValue = val;
|
||||
return(old);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlKeepBlanksDefault:
|
||||
* @val: int 0 or 1
|
||||
*
|
||||
* Set and return the previous value for default blanks text nodes support.
|
||||
* The 1.x version of the parser used an heuristic to try to detect
|
||||
* ignorable white spaces. As a result the SAX callback was generating
|
||||
* ignorableWhitespace() callbacks instead of characters() one, and when
|
||||
* using the DOM output text nodes containing those blanks were not generated.
|
||||
* The 2.x and later version will switch to the XML standard way and
|
||||
* ignorableWhitespace() are only generated when running the parser in
|
||||
* validating mode and when the current element doesn't allow CDATA or
|
||||
* mixed content.
|
||||
* This function is provided as a way to force the standard behaviour
|
||||
* on 1.X libs and to switch back to the old mode for compatibility when
|
||||
* running 1.X client code on 2.X . Upgrade of 1.X code should be done
|
||||
* by using xmlIsBlankNode() commodity function to detect the "empty"
|
||||
* nodes generated.
|
||||
* This value also affect autogeneration of indentation when saving code
|
||||
* if blanks sections are kept, indentation is not generated.
|
||||
*
|
||||
* Returns the last value for 0 for no substitution, 1 for substitution.
|
||||
*/
|
||||
|
||||
int
|
||||
xmlKeepBlanksDefault(int val) {
|
||||
int old = xmlKeepBlanksDefaultValue;
|
||||
|
||||
xmlKeepBlanksDefaultValue = val;
|
||||
xmlIndentTreeOutput = !val;
|
||||
return(old);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Deprecated functions kept for compatibility *
|
||||
|
Reference in New Issue
Block a user