diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2001-07-25 17:18:57 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2001-07-25 17:18:57 +0000 |
commit | a53c688b2e275cccfb13f46876aeae4a33fa4f5a (patch) | |
tree | f62e0ec3979c9cc885b90f5be3e117608dc42b73 /parserInternals.c | |
parent | d9bad13bb2d5894eb03f0cd36d26fffa81dd6f47 (diff) | |
download | android_external_libxml2-a53c688b2e275cccfb13f46876aeae4a33fa4f5a.tar.gz android_external_libxml2-a53c688b2e275cccfb13f46876aeae4a33fa4f5a.tar.bz2 android_external_libxml2-a53c688b2e275cccfb13f46876aeae4a33fa4f5a.zip |
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
Diffstat (limited to 'parserInternals.c')
-rw-r--r-- | parserInternals.c | 115 |
1 files changed, 114 insertions, 1 deletions
diff --git a/parserInternals.c b/parserInternals.c index 6eeae3db..e31e6f29 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -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) { @@ -2490,6 +2508,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 * * * ************************************************************************/ |