version 1.37, 1999/09/17 12:08:23
|
version 1.38, 1999/09/30 15:43:35
|
Line 59 void xmlFreeEntity(xmlEntityPtr entity)
|
Line 59 void xmlFreeEntity(xmlEntityPtr entity)
|
* xmlAddEntity : register a new entity for an entities table. |
* xmlAddEntity : register a new entity for an entities table. |
*/ |
*/ |
static void |
static void |
xmlAddEntity(xmlEntitiesTablePtr table, const CHAR *name, int type, |
xmlAddEntity(xmlEntitiesTablePtr table, const xmlChar *name, int type, |
const CHAR *ExternalID, const CHAR *SystemID, const CHAR *content) { |
const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content) { |
int i; |
int i; |
xmlEntityPtr cur; |
xmlEntityPtr cur; |
int len; |
int len; |
Line 126 xmlAddEntity(xmlEntitiesTablePtr table,
|
Line 126 xmlAddEntity(xmlEntitiesTablePtr table,
|
*/ |
*/ |
void xmlInitializePredefinedEntities(void) { |
void xmlInitializePredefinedEntities(void) { |
int i; |
int i; |
CHAR name[50]; |
xmlChar name[50]; |
CHAR value[50]; |
xmlChar value[50]; |
const char *in; |
const char *in; |
CHAR *out; |
xmlChar *out; |
|
|
if (xmlPredefinedEntities != NULL) return; |
if (xmlPredefinedEntities != NULL) return; |
|
|
Line 138 void xmlInitializePredefinedEntities(voi
|
Line 138 void xmlInitializePredefinedEntities(voi
|
sizeof(xmlPredefinedEntityValues[0]);i++) { |
sizeof(xmlPredefinedEntityValues[0]);i++) { |
in = xmlPredefinedEntityValues[i].name; |
in = xmlPredefinedEntityValues[i].name; |
out = &name[0]; |
out = &name[0]; |
for (;(*out++ = (CHAR) *in);)in++; |
for (;(*out++ = (xmlChar) *in);)in++; |
in = xmlPredefinedEntityValues[i].value; |
in = xmlPredefinedEntityValues[i].value; |
out = &value[0]; |
out = &value[0]; |
for (;(*out++ = (CHAR) *in);)in++; |
for (;(*out++ = (xmlChar) *in);)in++; |
xmlAddEntity(xmlPredefinedEntities, (const CHAR *) &name[0], |
xmlAddEntity(xmlPredefinedEntities, (const xmlChar *) &name[0], |
XML_INTERNAL_PREDEFINED_ENTITY, NULL, NULL, |
XML_INTERNAL_PREDEFINED_ENTITY, NULL, NULL, |
&value[0]); |
&value[0]); |
} |
} |
Line 157 void xmlInitializePredefinedEntities(voi
|
Line 157 void xmlInitializePredefinedEntities(voi
|
* Returns NULL if not, othervise the entity |
* Returns NULL if not, othervise the entity |
*/ |
*/ |
xmlEntityPtr |
xmlEntityPtr |
xmlGetPredefinedEntity(const CHAR *name) { |
xmlGetPredefinedEntity(const xmlChar *name) { |
int i; |
int i; |
xmlEntityPtr cur; |
xmlEntityPtr cur; |
|
|
Line 182 xmlGetPredefinedEntity(const CHAR *name)
|
Line 182 xmlGetPredefinedEntity(const CHAR *name)
|
* Register a new entity for this document DTD. |
* Register a new entity for this document DTD. |
*/ |
*/ |
void |
void |
xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type, |
xmlAddDtdEntity(xmlDocPtr doc, const xmlChar *name, int type, |
const CHAR *ExternalID, const CHAR *SystemID, const CHAR *content) { |
const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content) { |
xmlEntitiesTablePtr table; |
xmlEntitiesTablePtr table; |
|
|
if (doc->extSubset == NULL) { |
if (doc->extSubset == NULL) { |
Line 211 xmlAddDtdEntity(xmlDocPtr doc, const CHA
|
Line 211 xmlAddDtdEntity(xmlDocPtr doc, const CHA
|
* Register a new entity for this document. |
* Register a new entity for this document. |
*/ |
*/ |
void |
void |
xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type, |
xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, |
const CHAR *ExternalID, const CHAR *SystemID, const CHAR *content) { |
const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content) { |
xmlEntitiesTablePtr table; |
xmlEntitiesTablePtr table; |
|
|
if (doc == NULL) { |
if (doc == NULL) { |
Line 244 xmlAddDocEntity(xmlDocPtr doc, const CHA
|
Line 244 xmlAddDocEntity(xmlDocPtr doc, const CHA
|
* Returns A pointer to the entity structure or NULL if not found. |
* Returns A pointer to the entity structure or NULL if not found. |
*/ |
*/ |
xmlEntityPtr |
xmlEntityPtr |
xmlGetParameterEntity(xmlDocPtr doc, const CHAR *name) { |
xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name) { |
int i; |
int i; |
xmlEntityPtr cur; |
xmlEntityPtr cur; |
xmlEntitiesTablePtr table; |
xmlEntitiesTablePtr table; |
Line 290 xmlGetParameterEntity(xmlDocPtr doc, con
|
Line 290 xmlGetParameterEntity(xmlDocPtr doc, con
|
* Returns A pointer to the entity structure or NULL if not found. |
* Returns A pointer to the entity structure or NULL if not found. |
*/ |
*/ |
xmlEntityPtr |
xmlEntityPtr |
xmlGetDtdEntity(xmlDocPtr doc, const CHAR *name) { |
xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) { |
int i; |
int i; |
xmlEntityPtr cur; |
xmlEntityPtr cur; |
xmlEntitiesTablePtr table; |
xmlEntitiesTablePtr table; |
Line 319 xmlGetDtdEntity(xmlDocPtr doc, const CHA
|
Line 319 xmlGetDtdEntity(xmlDocPtr doc, const CHA
|
* Returns A pointer to the entity structure or NULL if not found. |
* Returns A pointer to the entity structure or NULL if not found. |
*/ |
*/ |
xmlEntityPtr |
xmlEntityPtr |
xmlGetDocEntity(xmlDocPtr doc, const CHAR *name) { |
xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { |
int i; |
int i; |
xmlEntityPtr cur; |
xmlEntityPtr cur; |
xmlEntitiesTablePtr table; |
xmlEntitiesTablePtr table; |
Line 368 xmlGetDocEntity(xmlDocPtr doc, const CHA
|
Line 368 xmlGetDocEntity(xmlDocPtr doc, const CHA
|
* A buffer used for converting entities to their equivalent and back. |
* A buffer used for converting entities to their equivalent and back. |
*/ |
*/ |
static int buffer_size = 0; |
static int buffer_size = 0; |
static CHAR *buffer = NULL; |
static xmlChar *buffer = NULL; |
|
|
void growBuffer(void) { |
void growBuffer(void) { |
buffer_size *= 2; |
buffer_size *= 2; |
buffer = (CHAR *) xmlRealloc(buffer, buffer_size * sizeof(CHAR)); |
buffer = (xmlChar *) xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); |
if (buffer == NULL) { |
if (buffer == NULL) { |
perror("realloc failed"); |
perror("realloc failed"); |
exit(1); |
exit(1); |
Line 396 void growBuffer(void) {
|
Line 396 void growBuffer(void) {
|
* |
* |
* Returns A newly allocated string with the substitution done. |
* Returns A newly allocated string with the substitution done. |
*/ |
*/ |
const CHAR * |
const xmlChar * |
xmlEncodeEntities(xmlDocPtr doc, const CHAR *input) { |
xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) { |
const CHAR *cur = input; |
const xmlChar *cur = input; |
CHAR *out = buffer; |
xmlChar *out = buffer; |
static int warning = 1; |
static int warning = 1; |
|
|
if (warning) { |
if (warning) { |
Line 411 xmlEncodeEntities(xmlDocPtr doc, const C
|
Line 411 xmlEncodeEntities(xmlDocPtr doc, const C
|
if (input == NULL) return(NULL); |
if (input == NULL) return(NULL); |
if (buffer == NULL) { |
if (buffer == NULL) { |
buffer_size = 1000; |
buffer_size = 1000; |
buffer = (CHAR *) xmlMalloc(buffer_size * sizeof(CHAR)); |
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); |
if (buffer == NULL) { |
if (buffer == NULL) { |
perror("malloc failed"); |
perror("malloc failed"); |
exit(1); |
exit(1); |
Line 466 xmlEncodeEntities(xmlDocPtr doc, const C
|
Line 466 xmlEncodeEntities(xmlDocPtr doc, const C
|
*/ |
*/ |
*out++ = *cur; |
*out++ = *cur; |
#ifndef USE_UTF_8 |
#ifndef USE_UTF_8 |
} else if ((sizeof(CHAR) == 1) && (*cur >= 0x80)) { |
} else if ((sizeof(xmlChar) == 1) && (*cur >= 0x80)) { |
char buf[10], *ptr; |
char buf[10], *ptr; |
#ifdef HAVE_SNPRINTF |
#ifdef HAVE_SNPRINTF |
snprintf(buf, 9, "&#%d;", *cur); |
snprintf(buf, 9, "&#%d;", *cur); |
Line 507 xmlEncodeEntities(xmlDocPtr doc, const C
|
Line 507 xmlEncodeEntities(xmlDocPtr doc, const C
|
*/ |
*/ |
#define growBufferReentrant() { \ |
#define growBufferReentrant() { \ |
buffer_size *= 2; \ |
buffer_size *= 2; \ |
buffer = (CHAR *) xmlRealloc(buffer, buffer_size * sizeof(CHAR)); \ |
buffer = (xmlChar *) xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ |
if (buffer == NULL) { \ |
if (buffer == NULL) { \ |
perror("realloc failed"); \ |
perror("realloc failed"); \ |
exit(1); \ |
exit(1); \ |
Line 530 xmlEncodeEntities(xmlDocPtr doc, const C
|
Line 530 xmlEncodeEntities(xmlDocPtr doc, const C
|
* |
* |
* Returns A newly allocated string with the substitution done. |
* Returns A newly allocated string with the substitution done. |
*/ |
*/ |
CHAR * |
xmlChar * |
xmlEncodeEntitiesReentrant(xmlDocPtr doc, const CHAR *input) { |
xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { |
const CHAR *cur = input; |
const xmlChar *cur = input; |
CHAR *buffer = NULL; |
xmlChar *buffer = NULL; |
CHAR *out = NULL; |
xmlChar *out = NULL; |
int buffer_size = 0; |
int buffer_size = 0; |
|
|
if (input == NULL) return(NULL); |
if (input == NULL) return(NULL); |
Line 543 xmlEncodeEntitiesReentrant(xmlDocPtr doc
|
Line 543 xmlEncodeEntitiesReentrant(xmlDocPtr doc
|
* allocate an translation buffer. |
* allocate an translation buffer. |
*/ |
*/ |
buffer_size = 1000; |
buffer_size = 1000; |
buffer = (CHAR *) xmlMalloc(buffer_size * sizeof(CHAR)); |
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); |
if (buffer == NULL) { |
if (buffer == NULL) { |
perror("malloc failed"); |
perror("malloc failed"); |
exit(1); |
exit(1); |
Line 598 xmlEncodeEntitiesReentrant(xmlDocPtr doc
|
Line 598 xmlEncodeEntitiesReentrant(xmlDocPtr doc
|
*/ |
*/ |
*out++ = *cur; |
*out++ = *cur; |
#ifndef USE_UTF_8 |
#ifndef USE_UTF_8 |
} else if ((sizeof(CHAR) == 1) && (*cur >= 0x80)) { |
} else if ((sizeof(xmlChar) == 1) && (*cur >= 0x80)) { |
char buf[10], *ptr; |
char buf[10], *ptr; |
#ifdef HAVE_SNPRINTF |
#ifdef HAVE_SNPRINTF |
snprintf(buf, 9, "&#%d;", *cur); |
snprintf(buf, 9, "&#%d;", *cur); |