aboutsummaryrefslogtreecommitdiffstats
path: root/entities.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>1999-10-14 09:10:25 +0000
committerDaniel Veillard <veillard@src.gnome.org>1999-10-14 09:10:25 +0000
commit7c1206fc060fd4260f7c6f003c32fbbea3e542fd (patch)
tree355843d626573307ace64a03b5e3aa34971b3f2a /entities.c
parent7d2c276a65a077932bbe2ae5a1b3af304175f995 (diff)
downloadandroid_external_libxml2-7c1206fc060fd4260f7c6f003c32fbbea3e542fd.tar.gz
android_external_libxml2-7c1206fc060fd4260f7c6f003c32fbbea3e542fd.tar.bz2
android_external_libxml2-7c1206fc060fd4260f7c6f003c32fbbea3e542fd.zip
Revamped HTML parsing, lots of bug fixes for HTML stuff,
Added xmlValidGetValidElements and xmlValidGetPotentialChildren, Completed and cleaned up the tests, Added doc for new modules gnome-xml-xmlmemory.html and gnome-xml-nanohttp.html, Daniel
Diffstat (limited to 'entities.c')
-rw-r--r--entities.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/entities.c b/entities.c
index 78f7ec2c..78571e02 100644
--- a/entities.c
+++ b/entities.c
@@ -401,6 +401,8 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
const xmlChar *cur = input;
xmlChar *out = buffer;
static int warning = 1;
+ int html = 0;
+
if (warning) {
fprintf(stderr, "Deprecated API xmlEncodeEntities() used\n");
@@ -409,6 +411,9 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
}
if (input == NULL) return(NULL);
+ if (doc != NULL)
+ html = (doc->type == XML_HTML_DOCUMENT_NODE);
+
if (buffer == NULL) {
buffer_size = 1000;
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
@@ -452,7 +457,7 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
*out++ = 'o';
*out++ = 't';
*out++ = ';';
- } else if (*cur == '\'') {
+ } else if ((*cur == '\'') && (!html)) {
*out++ = '&';
*out++ = 'a';
*out++ = 'p';
@@ -536,8 +541,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
xmlChar *buffer = NULL;
xmlChar *out = NULL;
int buffer_size = 0;
+ int html = 0;
if (input == NULL) return(NULL);
+ if (doc != NULL)
+ html = (doc->type == XML_HTML_DOCUMENT_NODE);
/*
* allocate an translation buffer.
@@ -584,7 +592,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
*out++ = 'o';
*out++ = 't';
*out++ = ';';
- } else if (*cur == '\'') {
+ } else if ((*cur == '\'') && (!html)) {
*out++ = '&';
*out++ = 'a';
*out++ = 'p';