mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-14 20:01:04 +03:00
Finally commiting work done on the plane, major cleanup,
spread some serious anti bitrot all over the place: - parserInternals.c parserInternals.h parser.c Makefile.am: created a new module parserInternals.c, moved most of the code shared by the various parsers there, as well as deprecated code from parser.c. More cleanup of parser.c - uri.c: fixed a problem when URI is NULL - valid.c: speedup when looking for an attribute declaration Daniel
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
Wed Sep 13 22:03:18 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
|
* parserInternals.c parserInternals.h parser.c Makefile.am:
|
||||||
|
created a new module parserInternals.c, moved most of the
|
||||||
|
code shared by the various parsers there, as well as
|
||||||
|
deprecated code from parser.c. More cleanup of parser.c
|
||||||
|
* uri.c: fixed a problem when URI is NULL
|
||||||
|
* valid.c: speedup when looking for an attribute declaration
|
||||||
|
|
||||||
Sun Sep 10 17:53:48 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
Sun Sep 10 17:53:48 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
* uri.c tree.c SAX.c parser.c entities.c debugXML.c: finished
|
* uri.c tree.c SAX.c parser.c entities.c debugXML.c: finished
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
#include "xml-error.h"
|
#include "xml-error.h"
|
||||||
|
|
||||||
#define HTML_MAX_NAMELEN 1000
|
#define HTML_MAX_NAMELEN 1000
|
||||||
#define INPUT_CHUNK 50
|
|
||||||
#define HTML_PARSER_BIG_BUFFER_SIZE 1000
|
#define HTML_PARSER_BIG_BUFFER_SIZE 1000
|
||||||
#define HTML_PARSER_BUFFER_SIZE 100
|
#define HTML_PARSER_BUFFER_SIZE 100
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ libxml_la_SOURCES = \
|
|||||||
entities.c \
|
entities.c \
|
||||||
encoding.c \
|
encoding.c \
|
||||||
error.c \
|
error.c \
|
||||||
|
parserInternals.c \
|
||||||
parser.c \
|
parser.c \
|
||||||
tree.c \
|
tree.c \
|
||||||
xmlIO.c \
|
xmlIO.c \
|
||||||
|
@ -371,6 +371,7 @@ xmlDocPtr xmlRecoverFile (const char *filename);
|
|||||||
* Less common routines and SAX interfaces
|
* Less common routines and SAX interfaces
|
||||||
*/
|
*/
|
||||||
int xmlParseDocument (xmlParserCtxtPtr ctxt);
|
int xmlParseDocument (xmlParserCtxtPtr ctxt);
|
||||||
|
int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
|
||||||
xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
|
xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
|
||||||
xmlChar *cur,
|
xmlChar *cur,
|
||||||
int recovery);
|
int recovery);
|
||||||
@ -388,6 +389,9 @@ xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
|
|||||||
xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
|
xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
int recovery);
|
int recovery);
|
||||||
|
xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
|
||||||
|
const char *filename);
|
||||||
|
xmlDocPtr xmlParseEntity (const char *filename);
|
||||||
xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
|
xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
|
||||||
const xmlChar *SystemID);
|
const xmlChar *SystemID);
|
||||||
xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
|
xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
|
||||||
|
@ -15,8 +15,18 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Identifiers can be longer, but this will be more costly
|
||||||
|
* at runtime.
|
||||||
|
*/
|
||||||
#define XML_MAX_NAMELEN 100
|
#define XML_MAX_NAMELEN 100
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The parser tries to always have that amount of input ready
|
||||||
|
* one of the point is providing context when reporting errors
|
||||||
|
*/
|
||||||
|
#define INPUT_CHUNK 250
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* UNICODE version of the macros. *
|
* UNICODE version of the macros. *
|
||||||
@ -87,6 +97,18 @@ extern "C" {
|
|||||||
#define MOVETO_STARTTAG(p) \
|
#define MOVETO_STARTTAG(p) \
|
||||||
while ((*p) && (*(p) != '<')) (p)++
|
while ((*p) && (*(p) != '<')) (p)++
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global vaiables affecting the default parser behaviour.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int xmlParserDebugEntities;
|
||||||
|
extern int xmlGetWarningsDefaultValue;
|
||||||
|
extern int xmlParserDebugEntities;
|
||||||
|
extern int xmlSubstituteEntitiesDefaultValue;
|
||||||
|
extern int xmlDoValidityCheckingDefaultValue;
|
||||||
|
extern int xmlPedanticParserDefaultValue;
|
||||||
|
extern int xmlKeepBlanksDefaultValue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function to finish teh work of the macros where needed
|
* Function to finish teh work of the macros where needed
|
||||||
*/
|
*/
|
||||||
@ -101,12 +123,6 @@ int xmlIsExtender (int c);
|
|||||||
int xmlIsCombining (int c);
|
int xmlIsCombining (int c);
|
||||||
int xmlIsChar (int c);
|
int xmlIsChar (int c);
|
||||||
|
|
||||||
/**
|
|
||||||
* Not for the faint of heart
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int xmlParserDebugEntities;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parser context
|
* Parser context
|
||||||
*/
|
*/
|
||||||
@ -141,6 +157,7 @@ xmlChar xmlPopInput (xmlParserCtxtPtr ctxt);
|
|||||||
void xmlFreeInputStream (xmlParserInputPtr input);
|
void xmlFreeInputStream (xmlParserInputPtr input);
|
||||||
xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
|
xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
|
||||||
const char *filename);
|
const char *filename);
|
||||||
|
xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Namespaces.
|
* Namespaces.
|
||||||
@ -248,6 +265,18 @@ int inputPush (xmlParserCtxtPtr ctxt,
|
|||||||
xmlParserInputPtr value);
|
xmlParserInputPtr value);
|
||||||
xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
|
xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* other comodities shared between parser.c and parserInternals
|
||||||
|
*/
|
||||||
|
int xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
|
||||||
|
int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
|
||||||
|
const xmlChar *cur,
|
||||||
|
int *len);
|
||||||
|
void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
|
||||||
|
void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
|
||||||
|
xmlChar *namePop (xmlParserCtxtPtr ctxt);
|
||||||
|
int xmlCheckLanguageID (const xmlChar *lang);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Really core function shared with HTML parser
|
* Really core function shared with HTML parser
|
||||||
*/
|
*/
|
||||||
|
4
parser.h
4
parser.h
@ -371,6 +371,7 @@ xmlDocPtr xmlRecoverFile (const char *filename);
|
|||||||
* Less common routines and SAX interfaces
|
* Less common routines and SAX interfaces
|
||||||
*/
|
*/
|
||||||
int xmlParseDocument (xmlParserCtxtPtr ctxt);
|
int xmlParseDocument (xmlParserCtxtPtr ctxt);
|
||||||
|
int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
|
||||||
xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
|
xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
|
||||||
xmlChar *cur,
|
xmlChar *cur,
|
||||||
int recovery);
|
int recovery);
|
||||||
@ -388,6 +389,9 @@ xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
|
|||||||
xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
|
xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
int recovery);
|
int recovery);
|
||||||
|
xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
|
||||||
|
const char *filename);
|
||||||
|
xmlDocPtr xmlParseEntity (const char *filename);
|
||||||
xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
|
xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
|
||||||
const xmlChar *SystemID);
|
const xmlChar *SystemID);
|
||||||
xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
|
xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
|
||||||
|
3055
parserInternals.c
Normal file
3055
parserInternals.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,8 +15,18 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Identifiers can be longer, but this will be more costly
|
||||||
|
* at runtime.
|
||||||
|
*/
|
||||||
#define XML_MAX_NAMELEN 100
|
#define XML_MAX_NAMELEN 100
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The parser tries to always have that amount of input ready
|
||||||
|
* one of the point is providing context when reporting errors
|
||||||
|
*/
|
||||||
|
#define INPUT_CHUNK 250
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* UNICODE version of the macros. *
|
* UNICODE version of the macros. *
|
||||||
@ -87,6 +97,18 @@ extern "C" {
|
|||||||
#define MOVETO_STARTTAG(p) \
|
#define MOVETO_STARTTAG(p) \
|
||||||
while ((*p) && (*(p) != '<')) (p)++
|
while ((*p) && (*(p) != '<')) (p)++
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global vaiables affecting the default parser behaviour.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int xmlParserDebugEntities;
|
||||||
|
extern int xmlGetWarningsDefaultValue;
|
||||||
|
extern int xmlParserDebugEntities;
|
||||||
|
extern int xmlSubstituteEntitiesDefaultValue;
|
||||||
|
extern int xmlDoValidityCheckingDefaultValue;
|
||||||
|
extern int xmlPedanticParserDefaultValue;
|
||||||
|
extern int xmlKeepBlanksDefaultValue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function to finish teh work of the macros where needed
|
* Function to finish teh work of the macros where needed
|
||||||
*/
|
*/
|
||||||
@ -101,12 +123,6 @@ int xmlIsExtender (int c);
|
|||||||
int xmlIsCombining (int c);
|
int xmlIsCombining (int c);
|
||||||
int xmlIsChar (int c);
|
int xmlIsChar (int c);
|
||||||
|
|
||||||
/**
|
|
||||||
* Not for the faint of heart
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int xmlParserDebugEntities;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parser context
|
* Parser context
|
||||||
*/
|
*/
|
||||||
@ -141,6 +157,7 @@ xmlChar xmlPopInput (xmlParserCtxtPtr ctxt);
|
|||||||
void xmlFreeInputStream (xmlParserInputPtr input);
|
void xmlFreeInputStream (xmlParserInputPtr input);
|
||||||
xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
|
xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
|
||||||
const char *filename);
|
const char *filename);
|
||||||
|
xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Namespaces.
|
* Namespaces.
|
||||||
@ -248,6 +265,18 @@ int inputPush (xmlParserCtxtPtr ctxt,
|
|||||||
xmlParserInputPtr value);
|
xmlParserInputPtr value);
|
||||||
xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
|
xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* other comodities shared between parser.c and parserInternals
|
||||||
|
*/
|
||||||
|
int xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
|
||||||
|
int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
|
||||||
|
const xmlChar *cur,
|
||||||
|
int *len);
|
||||||
|
void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
|
||||||
|
void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
|
||||||
|
xmlChar *namePop (xmlParserCtxtPtr ctxt);
|
||||||
|
int xmlCheckLanguageID (const xmlChar *lang);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Really core function shared with HTML parser
|
* Really core function shared with HTML parser
|
||||||
*/
|
*/
|
||||||
|
5
uri.c
5
uri.c
@ -1467,6 +1467,11 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
|
|||||||
xmlURIPtr bas = NULL;
|
xmlURIPtr bas = NULL;
|
||||||
xmlURIPtr res = NULL;
|
xmlURIPtr res = NULL;
|
||||||
|
|
||||||
|
if ((URI == NULL) && (base == NULL))
|
||||||
|
return(NULL);
|
||||||
|
if (URI == NULL)
|
||||||
|
return((xmlChar *) xmlMemStrdup((const char *) base));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1) The URI reference is parsed into the potential four components and
|
* 1) The URI reference is parsed into the potential four components and
|
||||||
* fragment identifier, as described in Section 4.3.
|
* fragment identifier, as described in Section 4.3.
|
||||||
|
29
valid.c
29
valid.c
@ -2294,14 +2294,41 @@ xmlGetDtdQElementDesc(xmlDtdPtr dtd, const xmlChar *name,
|
|||||||
xmlAttributePtr
|
xmlAttributePtr
|
||||||
xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
|
xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
|
||||||
xmlAttributeTablePtr table;
|
xmlAttributeTablePtr table;
|
||||||
|
xmlElementTablePtr etable;
|
||||||
xmlAttributePtr cur;
|
xmlAttributePtr cur;
|
||||||
|
xmlElementPtr ecur;
|
||||||
xmlChar *uqname = NULL, *prefix = NULL;
|
xmlChar *uqname = NULL, *prefix = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dtd == NULL) return(NULL);
|
if (dtd == NULL) return(NULL);
|
||||||
if (dtd->attributes == NULL) return(NULL);
|
if (dtd->attributes == NULL) return(NULL);
|
||||||
table = (xmlAttributeTablePtr) dtd->attributes;
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Faster lookup through the element table
|
||||||
|
*/
|
||||||
|
etable = (xmlElementTablePtr) dtd->elements;
|
||||||
|
if (etable != NULL) {
|
||||||
|
for (i = 0;i < etable->nb_elements;i++) {
|
||||||
|
ecur = etable->table[i];
|
||||||
|
if (!xmlStrcmp(ecur->name, elem)) {
|
||||||
|
cur = ecur->attributes;
|
||||||
|
while (cur != NULL) {
|
||||||
|
if (!xmlStrcmp(cur->name, name))
|
||||||
|
return(cur);
|
||||||
|
cur = cur->nexth;
|
||||||
|
}
|
||||||
|
/* TODO: same accelerator for QNames !!! */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Miss on the element table, retry on the attribute one
|
||||||
|
*/
|
||||||
|
|
||||||
|
table = (xmlAttributeTablePtr) dtd->attributes;
|
||||||
|
if (table == NULL)
|
||||||
|
return(NULL);
|
||||||
for (i = 0;i < table->nb_attributes;i++) {
|
for (i = 0;i < table->nb_attributes;i++) {
|
||||||
cur = table->table[i];
|
cur = table->table[i];
|
||||||
if ((!xmlStrcmp(cur->name, name)) &&
|
if ((!xmlStrcmp(cur->name, name)) &&
|
||||||
|
3
xlink.c
3
xlink.c
@ -164,12 +164,13 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
|
|||||||
} else {
|
} else {
|
||||||
xmlChar buf[200];
|
xmlChar buf[200];
|
||||||
#ifdef HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
snprintf((char *) buf, 199, "%s:external-linkset",
|
snprintf((char *) buf, sizeof(buf), "%s:external-linkset",
|
||||||
(char *) xlink->prefix);
|
(char *) xlink->prefix);
|
||||||
#else
|
#else
|
||||||
sprintf((char *) buf, "%s:external-linkset",
|
sprintf((char *) buf, "%s:external-linkset",
|
||||||
(char *) xlink->prefix);
|
(char *) xlink->prefix);
|
||||||
#endif
|
#endif
|
||||||
|
buf[sizeof(buf) - 1] = 0;
|
||||||
if (!xmlStrcmp(role, buf))
|
if (!xmlStrcmp(role, buf))
|
||||||
ret = XLINK_TYPE_EXTENDED_SET;
|
ret = XLINK_TYPE_EXTENDED_SET;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user