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
diff --git a/entities.c b/entities.c
index 78f7ec2..78571e0 100644
--- a/entities.c
+++ b/entities.c
@@ -401,6 +401,8 @@
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 @@
}
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 @@
*out++ = 'o';
*out++ = 't';
*out++ = ';';
- } else if (*cur == '\'') {
+ } else if ((*cur == '\'') && (!html)) {
*out++ = '&';
*out++ = 'a';
*out++ = 'p';
@@ -536,8 +541,11 @@
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 @@
*out++ = 'o';
*out++ = 't';
*out++ = ';';
- } else if (*cur == '\'') {
+ } else if ((*cur == '\'') && (!html)) {
*out++ = '&';
*out++ = 'a';
*out++ = 'p';