mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
rebuilt the API added the new options --nocdata and --nsclean to remove
* doc/libxml2-api.xml: rebuilt the API * xmllint.c doc/xmllint.1 doc/xmllint.xml: added the new options --nocdata and --nsclean to remove CDATA section and surperfluous namespace declarations * parser.c SAX2.c: implementation of the 2 new options Daniel
This commit is contained in:
23
parser.c
23
parser.c
@ -675,11 +675,24 @@ xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt,
|
||||
*
|
||||
* Pushes a new parser namespace on top of the ns stack
|
||||
*
|
||||
* Returns -1 in case of error, the index in the stack otherwise
|
||||
* Returns -1 in case of error, the index in the stack otherwise,
|
||||
* and -2 if the namespace should be discarded.
|
||||
*/
|
||||
static int
|
||||
nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL)
|
||||
{
|
||||
if (ctxt->options & XML_PARSE_NSCLEAN) {
|
||||
int i;
|
||||
for (i = 0;i < ctxt->nsNr;i += 2) {
|
||||
if (ctxt->nsTab[i] == prefix) {
|
||||
/* in scope */
|
||||
if (ctxt->nsTab[i + 1] == URL)
|
||||
return(-2);
|
||||
/* out of scope keep it */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ctxt->nsMax == 0) || (ctxt->nsTab == NULL)) {
|
||||
ctxt->nsMax = 10;
|
||||
ctxt->nsNr = 0;
|
||||
@ -12096,6 +12109,14 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
|
||||
} else {
|
||||
ctxt->dictNames = 1;
|
||||
}
|
||||
if (options & XML_PARSE_NOCDATA) {
|
||||
ctxt->sax->cdataBlock = NULL;
|
||||
options -= XML_PARSE_NOCDATA;
|
||||
}
|
||||
if (options & XML_PARSE_NSCLEAN) {
|
||||
ctxt->options |= XML_PARSE_NSCLEAN;
|
||||
options -= XML_PARSE_NSCLEAN;
|
||||
}
|
||||
return (options);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user