mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-20 14:03:33 +03:00
- DOCBparser.c SAX.c: a bit more work on entities processing.
Still Need to cleanup XML output and references in attributes Daniel
This commit is contained in:
parent
4ec0b0f4c3
commit
1034da2bff
@ -1,3 +1,8 @@
|
|||||||
|
Wed Apr 25 21:05:31 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* DOCBparser.c SAX.c: a bit more work on entities processing.
|
||||||
|
Still Need to cleanup XML output and references in attributes
|
||||||
|
|
||||||
Wed Apr 25 17:52:27 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Wed Apr 25 17:52:27 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* DOCBparser.c include/Makefile.am: two patches from László Kovács
|
* DOCBparser.c include/Makefile.am: two patches from László Kovács
|
||||||
|
36
DOCBparser.c
36
DOCBparser.c
@ -69,6 +69,7 @@ static int docbParseCharRef(docbParserCtxtPtr ctxt);
|
|||||||
static xmlEntityPtr docbParseEntityRef(docbParserCtxtPtr ctxt,
|
static xmlEntityPtr docbParseEntityRef(docbParserCtxtPtr ctxt,
|
||||||
xmlChar **str);
|
xmlChar **str);
|
||||||
static void docbParseElement(docbParserCtxtPtr ctxt);
|
static void docbParseElement(docbParserCtxtPtr ctxt);
|
||||||
|
static void docbParseContent(docbParserCtxtPtr ctxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal description of an SGML element
|
* Internal description of an SGML element
|
||||||
@ -3880,16 +3881,9 @@ docbParseReference(docbParserCtxtPtr ctxt) {
|
|||||||
*/
|
*/
|
||||||
xent = docbParseEntityRef(ctxt, &name);
|
xent = docbParseEntityRef(ctxt, &name);
|
||||||
if (xent != NULL) {
|
if (xent != NULL) {
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) &&
|
if (((ctxt->replaceEntities) || (ctxt->loadsubset)) &&
|
||||||
(ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) {
|
((xent->children == NULL) &&
|
||||||
/*
|
(xent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY))) {
|
||||||
* Create a node.
|
|
||||||
*/
|
|
||||||
ctxt->sax->reference(ctxt->userData, xent->name);
|
|
||||||
return;
|
|
||||||
} else if (ctxt->replaceEntities) {
|
|
||||||
if ((xent->children == NULL) &&
|
|
||||||
(xent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
|
|
||||||
/*
|
/*
|
||||||
* we really need to fetch and parse the external entity
|
* we really need to fetch and parse the external entity
|
||||||
*/
|
*/
|
||||||
@ -3899,7 +3893,8 @@ docbParseReference(docbParserCtxtPtr ctxt) {
|
|||||||
parse = docbParseCtxtExternalEntity(ctxt,
|
parse = docbParseCtxtExternalEntity(ctxt,
|
||||||
xent->SystemID, xent->ExternalID, &children);
|
xent->SystemID, xent->ExternalID, &children);
|
||||||
xmlAddChildList((xmlNodePtr) xent, children);
|
xmlAddChildList((xmlNodePtr) xent, children);
|
||||||
}
|
}
|
||||||
|
if (ctxt->replaceEntities) {
|
||||||
if ((ctxt->node != NULL) && (xent->children != NULL)) {
|
if ((ctxt->node != NULL) && (xent->children != NULL)) {
|
||||||
/*
|
/*
|
||||||
* Seems we are generating the DOM content, do
|
* Seems we are generating the DOM content, do
|
||||||
@ -3916,6 +3911,14 @@ docbParseReference(docbParserCtxtPtr ctxt) {
|
|||||||
ctxt->nodemem = 0;
|
ctxt->nodemem = 0;
|
||||||
ctxt->nodelen = 0;
|
ctxt->nodelen = 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) &&
|
||||||
|
(ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) {
|
||||||
|
/*
|
||||||
|
* Create a node.
|
||||||
|
*/
|
||||||
|
ctxt->sax->reference(ctxt->userData, xent->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (name != NULL) {
|
} else if (name != NULL) {
|
||||||
ent = docbEntityLookup(name);
|
ent = docbEntityLookup(name);
|
||||||
@ -4795,7 +4798,7 @@ docbParseDocument(docbParserCtxtPtr ctxt) {
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlInitParserCtxt:
|
* docbInitParserCtxt:
|
||||||
* @ctxt: an SGML parser context
|
* @ctxt: an SGML parser context
|
||||||
*
|
*
|
||||||
* Initialize a parser context
|
* Initialize a parser context
|
||||||
@ -4877,14 +4880,14 @@ docbFreeParserCtxt(docbParserCtxtPtr ctxt)
|
|||||||
/**
|
/**
|
||||||
* docbCreateDocParserCtxt :
|
* docbCreateDocParserCtxt :
|
||||||
* @cur: a pointer to an array of xmlChar
|
* @cur: a pointer to an array of xmlChar
|
||||||
* @encoding: a free form C string describing the SGML document encoding, or NULL
|
* @encoding: the SGML document encoding, or NULL
|
||||||
*
|
*
|
||||||
* Create a parser context for an SGML document.
|
* Create a parser context for an SGML document.
|
||||||
*
|
*
|
||||||
* Returns the new parser context or NULL
|
* Returns the new parser context or NULL
|
||||||
*/
|
*/
|
||||||
static docbParserCtxtPtr
|
static docbParserCtxtPtr
|
||||||
docbCreateDocParserCtxt(xmlChar *cur, const char *encoding) {
|
docbCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) {
|
||||||
docbParserCtxtPtr ctxt;
|
docbParserCtxtPtr ctxt;
|
||||||
docbParserInputPtr input;
|
docbParserInputPtr input;
|
||||||
/* sgmlCharEncoding enc; */
|
/* sgmlCharEncoding enc; */
|
||||||
@ -5870,7 +5873,7 @@ docbParseDoc(xmlChar *cur, const char *encoding) {
|
|||||||
/**
|
/**
|
||||||
* docbCreateFileParserCtxt :
|
* docbCreateFileParserCtxt :
|
||||||
* @filename: the filename
|
* @filename: the filename
|
||||||
* @encoding: a free form C string describing the SGML document encoding, or NULL
|
* @encoding: the SGML document encoding, or NULL
|
||||||
*
|
*
|
||||||
* Create a parser context for a file content.
|
* Create a parser context for a file content.
|
||||||
* Automatic support for ZLIB/Compress compressed document is provided
|
* Automatic support for ZLIB/Compress compressed document is provided
|
||||||
@ -5879,7 +5882,8 @@ docbParseDoc(xmlChar *cur, const char *encoding) {
|
|||||||
* Returns the new parser context or NULL
|
* Returns the new parser context or NULL
|
||||||
*/
|
*/
|
||||||
docbParserCtxtPtr
|
docbParserCtxtPtr
|
||||||
docbCreateFileParserCtxt(const char *filename, const char *encoding)
|
docbCreateFileParserCtxt(const char *filename,
|
||||||
|
const char *encoding ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
docbParserCtxtPtr ctxt;
|
docbParserCtxtPtr ctxt;
|
||||||
docbParserInputPtr inputStream;
|
docbParserInputPtr inputStream;
|
||||||
|
4
SAX.c
4
SAX.c
@ -1721,7 +1721,7 @@ xmlSAXHandler docbDefaultSAXHandler = {
|
|||||||
endDocument,
|
endDocument,
|
||||||
startElement,
|
startElement,
|
||||||
endElement,
|
endElement,
|
||||||
NULL,
|
reference,
|
||||||
characters,
|
characters,
|
||||||
ignorableWhitespace,
|
ignorableWhitespace,
|
||||||
NULL,
|
NULL,
|
||||||
@ -1760,7 +1760,7 @@ docbDefaultSAXHandlerInit(void)
|
|||||||
docbDefaultSAXHandler.endDocument = endDocument;
|
docbDefaultSAXHandler.endDocument = endDocument;
|
||||||
docbDefaultSAXHandler.startElement = startElement;
|
docbDefaultSAXHandler.startElement = startElement;
|
||||||
docbDefaultSAXHandler.endElement = endElement;
|
docbDefaultSAXHandler.endElement = endElement;
|
||||||
docbDefaultSAXHandler.reference = NULL;
|
docbDefaultSAXHandler.reference = reference;
|
||||||
docbDefaultSAXHandler.characters = characters;
|
docbDefaultSAXHandler.characters = characters;
|
||||||
docbDefaultSAXHandler.cdataBlock = NULL;
|
docbDefaultSAXHandler.cdataBlock = NULL;
|
||||||
docbDefaultSAXHandler.ignorableWhitespace = ignorableWhitespace;
|
docbDefaultSAXHandler.ignorableWhitespace = ignorableWhitespace;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user