Commit b96e6438 authored by Daniel Veillard's avatar Daniel Veillard

Release 1.6, lot of fixes, more validation, code cleanup, added namespace

on attributes, Daniel.
parent 56316b09
Mon Aug 16 03:27:38 CEST 1999
Sun Aug 29 22:27:29 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* all .h : changed the prototype declaration indent as in gtk
* most .c : working on reducing the TODOs in the code
* most .c : cleanup though -pedantic and Insure++
* improvements on validation ID checkings.
* tree.[ch] SAX.c: added support for namespace on attributes #2022
* xml-config.in: closed #1810
Mon Aug 16 03:27:38 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* tree.h, valid.c, valid.h: more work on validity, IDs
* xpath.c: added/fixed comparidon and equlity, added a new isinf
......
......@@ -269,7 +269,7 @@ htmlElemDesc html40ElementTable[] = {
* any tag of each line implies the end of the current element if the type of
* that element is in the same line
*/
CHAR *htmlEquEnd[] = {
char *htmlEquEnd[] = {
"DT", "DD", "LI", "OPTION", NULL,
"H1", "H2", "H3", "H4", "H5", "H6", NULL,
"OL", "MENU", "DIR", "ADDRESS", "PRE", "LISTING", "XMP", NULL,
......@@ -284,7 +284,7 @@ NULL
/*
* start tags that imply the end of current element
*/
CHAR *htmlStartClose[] = {
char *htmlStartClose[] = {
"FORM", "FORM", "P", "HR", "H1", "H2", "H3", "H4", "H5", "H6",
"DL", "UL", "OL", "MENU", "DIR", "ADDRESS", "PRE",
"LISTING", "XMP", "HEAD", NULL,
......@@ -338,7 +338,7 @@ CHAR *htmlStartClose[] = {
NULL
};
static CHAR** htmlStartCloseIndex[100];
static char** htmlStartCloseIndex[100];
static int htmlStartCloseIndexinitialized = 0;
/************************************************************************
......@@ -382,7 +382,7 @@ htmlTagLookup(const CHAR *tag) {
for (i = 0; i < (sizeof(html40ElementTable) /
sizeof(html40ElementTable[0]));i++) {
if (!xmlStrcmp(tag, html40ElementTable[i].name))
if (!xmlStrcmp(tag, BAD_CAST html40ElementTable[i].name))
return(&html40ElementTable[i]);
}
return(NULL);
......@@ -401,7 +401,7 @@ htmlTagLookup(const CHAR *tag) {
int
htmlCheckAutoClose(const CHAR *new, const CHAR *old) {
int i, index;
CHAR **close;
char **close;
if (htmlStartCloseIndexinitialized == 0) htmlInitAutoClose();
......@@ -409,13 +409,13 @@ htmlCheckAutoClose(const CHAR *new, const CHAR *old) {
for (index = 0; index < 100;index++) {
close = htmlStartCloseIndex[index];
if (close == NULL) return(0);
if (!xmlStrcmp(*close, new)) break;
if (!xmlStrcmp(BAD_CAST *close, new)) break;
}
i = close - htmlStartClose;
i++;
while (htmlStartClose[i] != NULL) {
if (!xmlStrcmp(htmlStartClose[i], old)) {
if (!xmlStrcmp(BAD_CAST htmlStartClose[i], old)) {
return(1);
}
i++;
......@@ -789,7 +789,7 @@ htmlEntityLookup(const CHAR *name) {
for (i = 0;i < (sizeof(html40EntitiesTable)/
sizeof(html40EntitiesTable[0]));i++) {
if (!xmlStrcmp(name, html40EntitiesTable[i].name)) {
if (!xmlStrcmp(name, BAD_CAST html40EntitiesTable[i].name)) {
#ifdef DEBUG
printf("Found entity %s\n", name);
#endif
......@@ -850,7 +850,7 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
if (CUR == '&') {
if (NXT(1) == '#') {
int val = htmlParseCharRef(ctxt);
/* TODO: invalid for UTF-8 variable encoding !!! */
/* invalid for UTF-8 variable encoding !!!!! */
*out++ = val;
nbchars += 3; /* !!!! */
} else {
......@@ -871,7 +871,7 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
}
*out++ = ';';
} else {
/* TODO: invalid for UTF-8 variable encoding !!! */
/* invalid for UTF-8 variable encoding !!!!! */
*out++ = (CHAR)ent->value;
if (out - buffer > buffer_size - 100) {
int index = out - buffer;
......@@ -885,7 +885,7 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
}
}
} else {
/* TODO: invalid for UTF-8 , use COPY(out); */
/* invalid for UTF-8 , use COPY(out); !!!!! */
*out++ = CUR;
nbchars++;
if (out - buffer > buffer_size - 100) {
......@@ -1050,8 +1050,6 @@ htmlSwitchEncoding(htmlParserCtxtPtr ctxt, xmlCharEncoding enc)
*
* Is this a sequence of blank chars that one can ignore ?
*
* TODO: to be corrected accodingly to DTD information if available
*
* Returns 1 if ignorable 0 otherwise.
*/
......@@ -1125,7 +1123,7 @@ htmlNewDoc(const CHAR *URI, const CHAR *ExternalID) {
cur->type = XML_DOCUMENT_NODE;
cur->version = NULL;
cur->intSubset = NULL;
xmlCreateIntSubset(cur, "HTML", ExternalID, URI);
xmlCreateIntSubset(cur, BAD_CAST "HTML", ExternalID, URI);
cur->name = NULL;
cur->root = NULL;
cur->extSubset = NULL;
......@@ -1338,7 +1336,7 @@ htmlParseEntityRef(htmlParserCtxtPtr ctxt, CHAR **str) {
"htmlParseEntityRef: expecting ';'\n");
ctxt->wellFormed = 0;
if (ctxt->sax->characters != NULL) {
ctxt->sax->characters(ctxt->userData, "&", 1);
ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1);
ctxt->sax->characters(ctxt->userData, name, xmlStrlen(name));
}
free(name);
......@@ -1817,7 +1815,6 @@ htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) {
/*
* Cleanup, since we don't use all those identifiers
* TODO : the DOCTYPE if available should be stored !
*/
if (URI != NULL) free(URI);
if (ExternalID != NULL) free(ExternalID);
......@@ -2113,7 +2110,7 @@ htmlParseReference(htmlParserCtxtPtr ctxt) {
if (NXT(1) == '#') {
val = htmlParseCharRef(ctxt);
/* TODO: invalid for UTF-8 variable encoding !!! */
/* invalid for UTF-8 variable encoding !!!!! */
out[0] = val;
out[1] = 0;
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
......@@ -2123,12 +2120,12 @@ htmlParseReference(htmlParserCtxtPtr ctxt) {
if (name == NULL) return; /* Shall we output & anyway ? */
if ((ent == NULL) || (ent->value <= 0) || (ent->value >= 255)) {
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) {
ctxt->sax->characters(ctxt->userData, "&", 1);
ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1);
ctxt->sax->characters(ctxt->userData, name, xmlStrlen(name));
ctxt->sax->characters(ctxt->userData, ";", 1);
ctxt->sax->characters(ctxt->userData, BAD_CAST ";", 1);
}
} else {
/* TODO: invalid for UTF-8 variable encoding !!! */
/* invalid for UTF-8 variable encoding !!!!! */
out[0] = ent->value;
out[1] = 0;
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
......@@ -2339,16 +2336,11 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
GROW;
/*
* SAX: beginning of the document processing TODO: update for HTML.
* SAX: beginning of the document processing.
*/
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
/*
* We should check for encoding here and plug-in some
* conversion code TODO !!!!
*/
/*
* Wipe out everything which is before the first '<'
*/
......
......@@ -27,7 +27,7 @@ typedef xmlNodePtr htmlNodePtr;
* Internal description of an HTML element
*/
typedef struct htmlElemDesc {
const CHAR *name; /* The tag name */
const char *name; /* The tag name */
int startTag; /* Whether the start tag can be implied */
int endTag; /* Whether the end tag can be implied */
int empty; /* Is this an empty element ? */
......@@ -41,7 +41,7 @@ typedef struct htmlElemDesc {
*/
typedef struct htmlEntityDesc {
int value; /* the UNICODE value for the character */
const CHAR *name; /* The entity name */
const char *name; /* The entity name */
const char *desc; /* the description */
} htmlEntityDesc, *htmlEntityDescPtr;
......
......@@ -14,8 +14,10 @@
#include "valid.h"
#include "entities.h"
#include "xml-error.h"
#include "debugXML.h"
/* #define DEBUG_SAX */
/* #define DEBUG_SAX_TREE */
/**
* getPublicId:
......@@ -45,7 +47,7 @@ const CHAR *
getSystemId(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
return(ctxt->input->filename);
return(BAD_CAST ctxt->input->filename);
}
/**
......@@ -164,7 +166,7 @@ internalSubset(void *ctx, const CHAR *name,
* Ask the Entity resolver to load the damn thing
*/
if ((ctxt->directory != NULL) && (dtdCtxt->directory == NULL))
dtdCtxt->directory = xmlStrdup(ctxt->directory);
dtdCtxt->directory = (char *) xmlStrdup(BAD_CAST ctxt->directory);
if ((dtdCtxt->sax != NULL) && (dtdCtxt->sax->resolveEntity != NULL))
input = dtdCtxt->sax->resolveEntity(dtdCtxt->userData, ExternalID,
......@@ -182,7 +184,7 @@ internalSubset(void *ctx, const CHAR *name,
xmlSwitchEncoding(dtdCtxt, enc);
if (input->filename == NULL)
input->filename = xmlStrdup(SystemID);
input->filename = (char *) xmlStrdup(SystemID);
input->line = 1;
input->col = 1;
input->base = dtdCtxt->input->cur;
......@@ -234,15 +236,13 @@ resolveEntity(void *ctx, const CHAR *publicId, const CHAR *systemId)
#endif
/*
* TODO : not 100% sure that the appropriate handling in that case.
* TODO : resolveEntity, handling of http://.. or ftp://..
*/
if (systemId != NULL) {
if (!xmlStrncmp(systemId, "http://", 7)) {
/* !!!!!!!!! TODO */
} else if (!xmlStrncmp(systemId, "ftp://", 6)) {
/* !!!!!!!!! TODO */
if (!xmlStrncmp(systemId, BAD_CAST "http://", 7)) {
} else if (!xmlStrncmp(systemId, BAD_CAST "ftp://", 6)) {
} else {
return(xmlNewInputFromFile(ctxt, systemId));
return(xmlNewInputFromFile(ctxt, (char *) systemId));
}
}
return(NULL);
......@@ -390,7 +390,6 @@ elementDecl(void *ctx, const CHAR *name, int type,
* @systemId: The system ID of the entity
*
* What to do when a notation declaration has been parsed.
* TODO Not handled currently.
*/
void
notationDecl(void *ctx, const CHAR *name,
......@@ -421,18 +420,24 @@ notationDecl(void *ctx, const CHAR *name,
* @notationName: the name of the notation
*
* What to do when an unparsed entity declaration is parsed
* TODO Create an Entity node.
*/
void
unparsedEntityDecl(void *ctx, const CHAR *name,
const CHAR *publicId, const CHAR *systemId,
const CHAR *notationName)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
name, publicId, systemId, notationName);
#endif
if (ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateNotationUse(&ctxt->vctxt, ctxt->myDoc,
notationName);
xmlAddDocEntity(ctxt->myDoc, name,
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
publicId, systemId, notationName);
}
/**
......@@ -510,6 +515,7 @@ attribute(void *ctx, const CHAR *fullname, const CHAR *value)
xmlAttrPtr ret;
CHAR *name;
CHAR *ns;
xmlNsPtr namespace;
/****************
#ifdef DEBUG_SAX
......@@ -543,15 +549,29 @@ attribute(void *ctx, const CHAR *fullname, const CHAR *value)
return;
}
ret = xmlNewProp(ctxt->node, name, NULL);
namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns);
/* !!!!!! <a toto:arg="" xmlns:toto="http://toto.com"> */
ret = xmlNewNsProp(ctxt->node, namespace, name, NULL);
if ((ret != NULL) && (ctxt->replaceEntities == 0))
ret->val = xmlStringGetNodeList(ctxt->myDoc, value);
if (ret != NULL) {
if (ctxt->replaceEntities == 0)
ret->val = xmlStringGetNodeList(ctxt->myDoc, value);
else
ret->val = xmlNewDocText(ctxt->myDoc, value);
}
if (ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, ret, value);
else {
/*
* when validating, the ID registration is done at the attribute
* validation level. Otherwise we have to do specific handling here.
*/
if (xmlIsID(ctxt->myDoc, ctxt->node, ret))
xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret);
}
if (name != NULL)
free(name);
......@@ -566,7 +586,6 @@ attribute(void *ctx, const CHAR *fullname, const CHAR *value)
* @atts: An array of name/value attributes pairs, NULL terminated
*
* called when an opening tag has been processed.
* TODO We currently have a small pblm with the arguments ...
*/
void
startElement(void *ctx, const CHAR *fullname, const CHAR **atts)
......@@ -598,32 +617,67 @@ startElement(void *ctx, const CHAR *fullname, const CHAR **atts)
*/
ret = xmlNewDocNode(ctxt->myDoc, NULL, name, NULL);
if (ret == NULL) return;
if (ctxt->myDoc->root == NULL)
if (ctxt->myDoc->root == NULL) {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "Setting %s as root\n", name);
#endif
ctxt->myDoc->root = ret;
} else if (parent == NULL) {
parent = ctxt->myDoc->root;
}
/*
* We are parsing a new node.
*/
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "pushing(%s)\n", name);
#endif
nodePush(ctxt, ret);
/*
* Link the child element
*/
if (parent != NULL)
xmlAddChild(parent, ctxt->node);
if (parent != NULL) {
if (parent->type == XML_ELEMENT_NODE) {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "adding child %s to %s\n", name, parent->name);
#endif
xmlAddChild(parent, ret);
} else {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "adding sibling %s to ", name);
xmlDebugDumpOneNode(stderr, parent, 0);
#endif
xmlAddSibling(parent, ret);
}
}
/*
* process all the attributes whose name start with "xml"
*/
if (atts != NULL) {
i = 0;
att = atts[i++];
value = atts[i++];
while ((att != NULL) && (value != NULL)) {
if ((att[0] == 'x') && (att[1] == 'm') && (att[2] == 'l'))
attribute(ctxt, att, value);
att = atts[i++];
value = atts[i++];
}
}
/*
* process all the attributes.
* process all the other attributes
*/
if (atts != NULL) {
i = 0;
att = atts[i++];
value = atts[i++];
while ((att != NULL) && (value != NULL)) {
/*
* Handle one pair of attribute/value
*/
attribute(ctxt, att, value);
if ((att[0] != 'x') || (att[1] != 'm') || (att[2] != 'l'))
attribute(ctxt, att, value);
/*
* Next ones
......@@ -687,6 +741,9 @@ endElement(void *ctx, const CHAR *name)
/*
* end of parsing of this node.
*/
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "popping(%s)\n", cur->name);
#endif
nodePop(ctxt);
}
......@@ -707,6 +764,9 @@ reference(void *ctx, const CHAR *name)
fprintf(stderr, "SAX.reference(%s)\n", name);
#endif
ret = xmlNewReference(ctxt->myDoc, name);
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "add reference %s to %s \n", name, ctxt->node->name);
#endif
xmlAddChild(ctxt->node, ret);
}
......@@ -735,6 +795,9 @@ characters(void *ctx, const CHAR *ch, int len)
*/
lastChild = xmlGetLastChild(ctxt->node);
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "add chars to %s \n", ctxt->node->name);
#endif
if (lastChild == NULL)
xmlNodeAddContentLen(ctxt->node, ch, len);
else {
......@@ -778,10 +841,40 @@ void
processingInstruction(void *ctx, const CHAR *target,
const CHAR *data)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNodePtr ret;
xmlNodePtr parent = ctxt->node;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.processingInstruction(%s, %s)\n", target, data);
#endif
ret = xmlNewPI(target, data);
if (ret == NULL) return;
ret->doc = ctxt->myDoc;
if (ctxt->myDoc->root == NULL) {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "Setting PI %s as root\n", target);
#endif
ctxt->myDoc->root = ret;
} else if (parent == NULL) {
parent = ctxt->myDoc->root;
}
if (parent != NULL) {
if (parent->type == XML_ELEMENT_NODE) {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "adding PI child %s to %s\n", target, parent->name);
#endif
xmlAddChild(parent, ret);
} else {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "adding PI sibling %s to ", target);
xmlDebugDumpOneNode(stderr, parent, 0);
#endif
xmlAddSibling(parent, ret);
}
}
}
/**
......@@ -885,7 +978,7 @@ checkNamespace(void *ctx, CHAR *namespace)
"End tags %s holds a prefix %s not used by the open tag\n",
cur->name, namespace);
ctxt->wellFormed = 0;
} else if (strcmp(namespace, cur->ns->prefix)) {
} else if (xmlStrcmp(namespace, cur->ns->prefix)) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt,
"Start and End tags for %s don't use the same namespaces: %s and %s\n",
......@@ -930,13 +1023,36 @@ comment(void *ctx, const CHAR *value)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNodePtr ret;
xmlNodePtr parent = ctxt->node;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.comment(%s)\n", value);
#endif
ret = xmlNewDocComment(ctxt->myDoc, value);
xmlAddChild(ctxt->node, ret);
/* !!!!! merges */
if (ret == NULL) return;
if (ctxt->myDoc->root == NULL) {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "Setting comment as root\n");
#endif
ctxt->myDoc->root = ret;
} else if (parent == NULL) {
parent = ctxt->myDoc->root;
}
if (parent != NULL) {
if (parent->type == XML_ELEMENT_NODE) {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "adding comment child to %s\n", parent->name);
#endif
xmlAddChild(parent, ret);
} else {
#ifdef DEBUG_SAX_TREE
fprintf(stderr, "adding comment sibling to ");
xmlDebugDumpOneNode(stderr, parent, 0);
#endif
xmlAddSibling(parent, ret);
}
}
}
/**
......@@ -954,7 +1070,7 @@ cdataBlock(void *ctx, const CHAR *value, int len)
xmlNodePtr ret;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.pcdata(%s, %d)\n", name, len);
fprintf(stderr, "SAX.pcdata(%.10s, %d)\n", value, len);
#endif
ret = xmlNewCDataBlock(ctxt->myDoc, value, len);
xmlAddChild(ctxt->node, ret);
......
......@@ -4,7 +4,7 @@ AC_INIT(entities.h)
AM_CONFIG_HEADER(config.h)
LIBXML_MAJOR_VERSION=1
LIBXML_MINOR_VERSION=5
LIBXML_MINOR_VERSION=6
LIBXML_MICRO_VERSION=0
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
......
......@@ -146,7 +146,7 @@ void xmlDebugDumpOneNode(FILE *output, xmlNodePtr node, int depth) {
fprintf(output, "ENTITY\n");
break;
case XML_PI_NODE:
fprintf(output, "PI\n");
fprintf(output, "PI %s\n", node->name);
break;
case XML_COMMENT_NODE:
fprintf(output, "COMMENT\n");
......@@ -252,7 +252,7 @@ void xmlDebugDumpDocument(FILE *output, xmlDocPtr doc) {
}
if (doc->name != NULL) {
fprintf(output, "name=");
xmlDebugDumpString(output, doc->name);
xmlDebugDumpString(output, BAD_CAST doc->name);
fprintf(output, "\n");
}
if (doc->version != NULL) {
......
......@@ -19,9 +19,13 @@
* Daniel.Veillard@w3.org
*/
#include "config.h"
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "encoding.h"
#ifdef HAVE_UNICODE_H
#include <unicode.h>
......@@ -85,7 +89,8 @@ isolat1ToUTF8(unsigned char* out, int outlen, unsigned char* in, int inlen)
*
* Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1
* block of chars out.
* TODO: need a fallback mechanism ...
* TODO: UTF8Toisolat1 need a fallback mechanism ...
*
* Returns the number of byte written, or -1 by lack of space, or -2
* if the transcoding failed.
*/
......@@ -169,7 +174,8 @@ UTF16ToUTF8(unsigned char* out, int outlen, unsigned short* in, int inlen)
*
* Take a block of UTF-8 chars in and try to convert it to an UTF-16
* block of chars out.
* TODO: need a fallback mechanism ...
* TODO: UTF8ToUTF16 need a fallback mechanism ...
*
* Returns the number of byte written, or -1 by lack of space, or -2
* if the transcoding failed.
*/
......@@ -416,7 +422,7 @@ xmlInitCharEncodingHandlers(void) {
xmlNewCharEncodingHandler("UTF-8", NULL, NULL);
#ifdef HAVE_UNICODE_H
#else
xmlNewCharEncodingHandler("UTF-16", UTF16ToUTF8, UTF8ToUTF16);
/* xmlNewCharEncodingHandler("UTF-16", UTF16ToUTF8, UTF8ToUTF16); */
xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1);
#endif
}
......@@ -455,7 +461,7 @@ xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
xmlCharEncodingHandlerPtr
xmlGetCharEncodingHandler(xmlCharEncoding enc) {
if (handlers == NULL) xmlInitCharEncodingHandlers();
/* TODO !!!!!!! */
/* TODO xmlGetCharEncodingHandler !!!!!!! */
return(NULL);
}
......
......@@ -51,7 +51,7 @@ typedef enum {
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
XML_CHAR_ENCODING_EUC_JP= 21 /* EUC-JP */
} xmlCharEncoding;
/**
......
......@@ -50,13 +50,10 @@ void xmlFreeEntity(xmlEntityPtr entity) {
/*
* xmlAddEntity : register a new entity for an entities table.
*
* TODO !!! We should check here that the combination of type
* ExternalID and SystemID is valid.
*/
static void
xmlAddEntity(xmlEntitiesTablePtr table, const CHAR *name, int type,
const CHAR *ExternalID, const CHAR *SystemID, CHAR *content) {
const CHAR *ExternalID, const CHAR *SystemID, const CHAR *content) {
int i;
xmlEntityPtr cur;
int len;
......@@ -67,6 +64,7 @@ xmlAddEntity(xmlEntitiesTablePtr table, const CHAR *name, int type,
/*
* The entity is already defined in this Dtd, the spec says to NOT
* override it ... Is it worth a Warning ??? !!!
* Not having a cprinting context this seems hard ...
*/
if (((type == XML_INTERNAL_PARAMETER_ENTITY) ||
(type == XML_EXTERNAL_PARAMETER_ENTITY)) &&
......@@ -178,7 +176,7 @@ xmlGetPredefinedEntity(const CHAR *name) {
*/
void
xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
const CHAR *ExternalID, const CHAR *SystemID, CHAR *content) {
const CHAR *ExternalID, const CHAR *SystemID, const CHAR *content) {
xmlEntitiesTablePtr table;
if (doc->extSubset == NULL) {
......@@ -207,7 +205,7 @@ xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
*/
void
xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type,
const CHAR *ExternalID, const CHAR *SystemID, CHAR *content) {
const CHAR *ExternalID, const CHAR *SystemID, const CHAR *content) {
xmlEntitiesTablePtr table;
if (doc == NULL) {
......@@ -343,8 +341,6 @@ xmlGetDocEntity(xmlDocPtr doc, const CHAR *name) {
/*
* A buffer used for converting entities to their equivalent and back.
*
* TODO: remove this, once we are not afraid of breaking binary compatibility
*/
static int buffer_size = 0;
static CHAR *buffer = NULL;
......@@ -367,7 +363,8 @@ void growBuffer(void) {
* Do a global encoding of a string, replacing the predefined entities
* and non ASCII values with their entities and CharRef counterparts.
*
* TODO: remove this, once we are not afraid of breaking binary compatibility
* TODO: remove xmlEncodeEntities, once we are not afraid of breaking binary
* compatibility
*
* People must migrate their code to xmlEncodeEntitiesReentrant !
* This routine will issue a warning when encountered.
......
......@@ -59,21 +59,35 @@ typedef xmlEntitiesTable *xmlEntitiesTablePtr;