diff options
author | Daniel Veillard <veillard@src.gnome.org> | 1999-01-17 19:11:59 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 1999-01-17 19:11:59 +0000 |
commit | 39a1f9a3a736c66a1ca491f4c4b339f573bd3f39 (patch) | |
tree | 0a7ca239619f3c8fa4693c1c2b443da61ff4dbce /entities.c | |
parent | 3c2c2ce4afd97571e740427c5702e2de6b4a8c69 (diff) | |
download | libxml2-39a1f9a3a736c66a1ca491f4c4b339f573bd3f39.tar.gz |
Speed, conformance testing, more parsing, general improvements, Daniel.
Diffstat (limited to 'entities.c')
-rw-r--r-- | entities.c | 35 |
1 files changed, 23 insertions, 12 deletions
@@ -3,7 +3,7 @@ * * See Copyright for the status of this software. * - * $Id$ + * Daniel.Veillard@w3.org */ #include <stdio.h> @@ -186,14 +186,15 @@ xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type, const CHAR *ExternalID, const CHAR *SystemID, CHAR *content) { xmlEntitiesTablePtr table; - if (doc->dtd == NULL) { - fprintf(stderr, "xmlAddDtdEntity: document without Dtd !\n"); + if (doc->extSubset == NULL) { + fprintf(stderr, + "xmlAddDtdEntity: document without external subset !\n"); return; } - table = (xmlEntitiesTablePtr) doc->dtd->entities; + table = (xmlEntitiesTablePtr) doc->extSubset->entities; if (table == NULL) { table = xmlCreateEntitiesTable(); - doc->dtd->entities = table; + doc->extSubset->entities = table; } xmlAddEntity(table, name, type, ExternalID, SystemID, content); } @@ -214,12 +215,22 @@ xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type, const CHAR *ExternalID, const CHAR *SystemID, CHAR *content) { xmlEntitiesTablePtr table; - table = (xmlEntitiesTablePtr) doc->entities; + if (doc == NULL) { + fprintf(stderr, + "xmlAddDocEntity: document is NULL !\n"); + return; + } + if (doc->intSubset == NULL) { + fprintf(stderr, + "xmlAddDtdEntity: document without internal subset !\n"); + return; + } + table = (xmlEntitiesTablePtr) doc->intSubset->entities; if (table == NULL) { table = xmlCreateEntitiesTable(); - doc->entities = table; + doc->intSubset->entities = table; } - xmlAddEntity(doc->entities, name, type, ExternalID, SystemID, content); + xmlAddEntity(table, name, type, ExternalID, SystemID, content); } /** @@ -238,8 +249,8 @@ xmlGetDtdEntity(xmlDocPtr doc, const CHAR *name) { xmlEntityPtr cur; xmlEntitiesTablePtr table; - if ((doc->dtd != NULL) && (doc->dtd->entities != NULL)) { - table = (xmlEntitiesTablePtr) doc->dtd->entities; + if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { + table = (xmlEntitiesTablePtr) doc->extSubset->entities; for (i = 0;i < table->nb_entities;i++) { cur = &table->table[i]; if (!xmlStrcmp(cur->name, name)) return(cur); @@ -265,8 +276,8 @@ xmlGetDocEntity(xmlDocPtr doc, const CHAR *name) { xmlEntityPtr cur; xmlEntitiesTablePtr table; - if (doc->entities != NULL) { - table = (xmlEntitiesTablePtr) doc->entities; + if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { + table = (xmlEntitiesTablePtr) doc->intSubset->entities; for (i = 0;i < table->nb_entities;i++) { cur = &table->table[i]; if (!xmlStrcmp(cur->name, name)) return(cur); |