GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit b1059e2f authored by Daniel Veillard's avatar Daniel Veillard

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
parent 39c7d71a
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>
* uri.c tree.c SAX.c parser.c entities.c debugXML.c: finished
......
......@@ -48,7 +48,6 @@
#include "xml-error.h"
#define HTML_MAX_NAMELEN 1000
#define INPUT_CHUNK 50
#define HTML_PARSER_BIG_BUFFER_SIZE 1000
#define HTML_PARSER_BUFFER_SIZE 100
......
......@@ -20,6 +20,7 @@ libxml_la_SOURCES = \
entities.c \
encoding.c \
error.c \
parserInternals.c \
parser.c \
tree.c \
xmlIO.c \
......
......@@ -371,6 +371,7 @@ xmlDocPtr xmlRecoverFile (const char *filename);
* Less common routines and SAX interfaces
*/
int xmlParseDocument (xmlParserCtxtPtr ctxt);
int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
xmlChar *cur,
int recovery);
......@@ -388,6 +389,9 @@ xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char *filename,
int recovery);
xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char *filename);
xmlDocPtr xmlParseEntity (const char *filename);
xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
const xmlChar *SystemID);
xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
......
......@@ -15,8 +15,18 @@
extern "C" {
#endif
/*
* Identifiers can be longer, but this will be more costly
* at runtime.
*/
#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. *
......@@ -87,6 +97,18 @@ extern "C" {
#define MOVETO_STARTTAG(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
*/
......@@ -101,12 +123,6 @@ int xmlIsExtender (int c);
int xmlIsCombining (int c);
int xmlIsChar (int c);
/**
* Not for the faint of heart
*/
extern int xmlParserDebugEntities;
/**
* Parser context
*/
......@@ -141,6 +157,7 @@ xmlChar xmlPopInput (xmlParserCtxtPtr ctxt);
void xmlFreeInputStream (xmlParserInputPtr input);
xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char *filename);
xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt);
/**
* Namespaces.
......@@ -248,6 +265,18 @@ int inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value);
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
*/
......
This diff is collapsed.
......@@ -371,6 +371,7 @@ xmlDocPtr xmlRecoverFile (const char *filename);
* Less common routines and SAX interfaces
*/
int xmlParseDocument (xmlParserCtxtPtr ctxt);
int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
xmlChar *cur,
int recovery);
......@@ -388,6 +389,9 @@ xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char *filename,
int recovery);
xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char *filename);
xmlDocPtr xmlParseEntity (const char *filename);
xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
const xmlChar *SystemID);
xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
......
This diff is collapsed.
......@@ -15,8 +15,18 @@
extern "C" {
#endif
/*
* Identifiers can be longer, but this will be more costly
* at runtime.
*/
#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. *
......@@ -87,6 +97,18 @@ extern "C" {
#define MOVETO_STARTTAG(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
*/
......@@ -101,12 +123,6 @@ int xmlIsExtender (int c);
int xmlIsCombining (int c);
int xmlIsChar (int c);
/**
* Not for the faint of heart
*/
extern int xmlParserDebugEntities;
/**
* Parser context
*/
......@@ -141,6 +157,7 @@ xmlChar xmlPopInput (xmlParserCtxtPtr ctxt);
void xmlFreeInputStream (xmlParserInputPtr input);
xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char *filename);
xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt);
/**
* Namespaces.
......@@ -248,6 +265,18 @@ int inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value);
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
*/
......
......@@ -1467,6 +1467,11 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
xmlURIPtr bas = 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
* fragment identifier, as described in Section 4.3.
......
......@@ -2294,14 +2294,41 @@ xmlGetDtdQElementDesc(xmlDtdPtr dtd, const xmlChar *name,
xmlAttributePtr
xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
xmlAttributeTablePtr table;
xmlElementTablePtr etable;
xmlAttributePtr cur;
xmlElementPtr ecur;
xmlChar *uqname = NULL, *prefix = NULL;
int i;
if (dtd == 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++) {
cur = table->table[i];
if ((!xmlStrcmp(cur->name, name)) &&
......
......@@ -164,12 +164,13 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
} else {
xmlChar buf[200];
#ifdef HAVE_SNPRINTF
snprintf((char *) buf, 199, "%s:external-linkset",
snprintf((char *) buf, sizeof(buf), "%s:external-linkset",
(char *) xlink->prefix);
#else
sprintf((char *) buf, "%s:external-linkset",
(char *) xlink->prefix);
#endif
buf[sizeof(buf) - 1] = 0;
if (!xmlStrcmp(role, buf))
ret = XLINK_TYPE_EXTENDED_SET;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment