diff -p -r1.121 tree.c *** tree.c 2001/04/11 07:50:01 1.121 --- tree.c 2001/04/11 11:21:37 *************** *** 36,41 **** --- 36,42 ---- #include #include #include + #include xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns); *************** static int xmlCompressMode = 0; *** 57,65 **** static int xmlCheckDTD = 1; int xmlSaveNoEmptyTags = 0; - #define IS_BLANK(c) \ - (((c) == '\n') || ((c) == '\r') || ((c) == '\t') || ((c) == ' ')) - #define UPDATE_LAST_CHILD_AND_PARENT(n) if ((n) != NULL) { \ xmlNodePtr ulccur = (n)->children; \ if (ulccur == NULL) { \ --- 58,63 ---- *************** xmlStringGetNodeList(xmlDocPtr doc, cons *** 646,656 **** q = cur; while (*cur != 0) { ! /* TODO: attributes can inherits & ... ! if ((*cur == '&') && (cur[1] == '#')) { ! int val = ! } else */ ! if (*cur == '&') { /* * Save the current text. */ --- 644,653 ---- q = cur; while (*cur != 0) { ! if (cur[0] == '&') { ! int charval = 0; ! xmlChar tmp; ! /* * Save the current text. */ *************** xmlStringGetNodeList(xmlDocPtr doc, cons *** 669,723 **** } } } - /* - * Read the entity string - */ - cur++; q = cur; ! while ((*cur != 0) && (*cur != ';')) cur++; ! if (*cur == 0) { ! #ifdef DEBUG_TREE ! xmlGenericError(xmlGenericErrorContext, ! "xmlStringGetNodeList: unterminated entity %30s\n", q); ! #endif ! return(ret); ! } ! if (cur != q) { /* ! * Predefined entities don't generate nodes */ ! val = xmlStrndup(q, cur - q); ! ent = xmlGetDocEntity(doc, val); ! if ((ent != NULL) && ! (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { ! if (last == NULL) { ! node = xmlNewDocText(doc, ent->content); ! last = ret = node; ! } else ! xmlNodeAddContent(last, ent->content); ! ! } else { /* ! * Create a new REFERENCE_REF node */ ! node = xmlNewReference(doc, val); ! if (node == NULL) { ! if (val != NULL) xmlFree(val); ! return(ret); } ! if (last == NULL) last = ret = node; ! else { ! last->next = node; ! node->prev = last; ! last = node; } } ! xmlFree(val); } ! cur++; ! q = cur; ! } else cur++; } if (cur != q) { --- 666,778 ---- } } } q = cur; ! if ((cur[1] == '#') && (cur[2] == 'x')) { ! cur += 3; ! tmp = *cur; ! while (tmp != ';') { /* Non input consuming loop */ ! if ((tmp >= '0') && (tmp <= '9')) ! charval = charval * 16 + (tmp - '0'); ! else if ((tmp >= 'a') && (tmp <= 'f')) ! charval = charval * 16 + (tmp - 'a') + 10; ! else if ((tmp >= 'A') && (tmp <= 'F')) ! charval = charval * 16 + (tmp - 'A') + 10; ! else { ! xmlGenericError(xmlGenericErrorContext, ! "xmlStringGetNodeList: incharvalid hexadecimal charvalue\n"); ! charval = 0; ! break; ! } ! cur++; ! tmp = *cur; ! } ! if (tmp == ';') ! cur++; ! q = cur; ! } else if (cur[1] == '#') { ! cur += 2; ! tmp = *cur; ! while (tmp != ';') { /* Non input consuming loops */ ! if ((tmp >= '0') && (tmp <= '9')) ! charval = charval * 10 + (tmp - '0'); ! else { ! xmlGenericError(xmlGenericErrorContext, ! "xmlStringGetNodeList: incharvalid decimal charvalue\n"); ! charval = 0; ! break; ! } ! cur++; ! tmp = *cur; ! } ! if (tmp == ';') ! cur++; ! q = cur; ! } else { /* ! * Read the entity string */ ! cur++; ! q = cur; ! while ((*cur != 0) && (*cur != ';')) cur++; ! if (*cur == 0) { ! #ifdef DEBUG_TREE ! xmlGenericError(xmlGenericErrorContext, ! "xmlStringGetNodeList: unterminated entity %30s\n", q); ! #endif ! return(ret); ! } ! if (cur != q) { /* ! * Predefined entities don't generate nodes */ ! val = xmlStrndup(q, cur - q); ! ent = xmlGetDocEntity(doc, val); ! if ((ent != NULL) && ! (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { ! if (last == NULL) { ! node = xmlNewDocText(doc, ent->content); ! last = ret = node; ! } else ! xmlNodeAddContent(last, ent->content); ! ! } else { ! /* ! * Create a new REFERENCE_REF node ! */ ! node = xmlNewReference(doc, val); ! if (node == NULL) { ! if (val != NULL) xmlFree(val); ! return(ret); ! } ! if (last == NULL) { ! last = ret = node; ! } else { ! last = xmlAddNextSibling(last, node); ! } } ! xmlFree(val); ! } ! cur++; ! q = cur; ! } ! if (charval != 0) { ! xmlChar buf[10]; ! int len; ! ! len = xmlCopyCharMultiByte(buf, charval); ! buf[len] = 0; ! node = xmlNewDocText(doc, buf); ! if (node != NULL) { ! if (last == NULL) { last = ret = node; ! } else { ! last = xmlAddNextSibling(last, node); } } ! ! charval = 0; } ! } else cur++; } if (cur != q) { *************** xmlStringGetNodeList(xmlDocPtr doc, cons *** 729,740 **** } else { node = xmlNewDocTextLen(doc, q, cur - q); if (node == NULL) return(ret); ! if (last == NULL) last = ret = node; ! else { ! last->next = node; ! node->prev = last; ! last = node; } } } --- 784,793 ---- } else { node = xmlNewDocTextLen(doc, q, cur - q); if (node == NULL) return(ret); ! if (last == NULL) { last = ret = node; ! } else { ! last = xmlAddNextSibling(last, node); } } }