Diff for /embedaddon/libxml2/SAX2.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:37:58 version 1.1.1.2, 2013/07/22 01:22:18
Line 1756  void Line 1756  void
 xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)  xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
 {  {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;      xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
     xmlParserNodeInfo node_info;  
     xmlNodePtr cur;      xmlNodePtr cur;
   
     if (ctx == NULL) return;      if (ctx == NULL) return;
Line 1770  xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRI Line 1769  xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRI
           
     /* Capture end position and add node */      /* Capture end position and add node */
     if (cur != NULL && ctxt->record_info) {      if (cur != NULL && ctxt->record_info) {
      node_info.end_pos = ctxt->input->cur - ctxt->input->base;      ctxt->nodeInfo->end_pos = ctxt->input->cur - ctxt->input->base;
      node_info.end_line = ctxt->input->line;      ctxt->nodeInfo->end_line = ctxt->input->line;
      node_info.node = cur;      ctxt->nodeInfo->node = cur;
      xmlParserAddNodeInfo(ctxt, &node_info);      xmlParserAddNodeInfo(ctxt, ctxt->nodeInfo);
     }      }
     ctxt->nodemem = -1;      ctxt->nodemem = -1;
   
Line 2163  xmlSAX2StartElementNs(void *ctx, Line 2162  xmlSAX2StartElementNs(void *ctx,
     xmlNodePtr parent;      xmlNodePtr parent;
     xmlNsPtr last = NULL, ns;      xmlNsPtr last = NULL, ns;
     const xmlChar *uri, *pref;      const xmlChar *uri, *pref;
       xmlChar *lname = NULL;
     int i, j;      int i, j;
   
     if (ctx == NULL) return;      if (ctx == NULL) return;
Line 2182  xmlSAX2StartElementNs(void *ctx, Line 2182  xmlSAX2StartElementNs(void *ctx,
     }      }
   
     /*      /*
        * Take care of the rare case of an undefined namespace prefix
        */
       if ((prefix != NULL) && (URI == NULL)) {
           if (ctxt->dictNames) {
               const xmlChar *fullname;
   
               fullname = xmlDictQLookup(ctxt->dict, prefix, localname);
               if (fullname != NULL)
                   localname = fullname;
           } else {
               lname = xmlBuildQName(localname, prefix, NULL, 0);
           }
       }
       /*
      * allocate the node       * allocate the node
      */       */
     if (ctxt->freeElems != NULL) {      if (ctxt->freeElems != NULL) {
Line 2194  xmlSAX2StartElementNs(void *ctx, Line 2208  xmlSAX2StartElementNs(void *ctx,
         if (ctxt->dictNames)          if (ctxt->dictNames)
             ret->name = localname;              ret->name = localname;
         else {          else {
            ret->name = xmlStrdup(localname);            if (lname == NULL)
                 ret->name = xmlStrdup(localname);
             else
                 ret->name = lname;
             if (ret->name == NULL) {              if (ret->name == NULL) {
                 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");                  xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
                 return;                  return;
Line 2206  xmlSAX2StartElementNs(void *ctx, Line 2223  xmlSAX2StartElementNs(void *ctx,
         if (ctxt->dictNames)          if (ctxt->dictNames)
             ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL,               ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, 
                                        (xmlChar *) localname, NULL);                                         (xmlChar *) localname, NULL);
        else        else if (lname == NULL)
             ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL);              ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL);
           else
               ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, 
                                          (xmlChar *) lname, NULL);
         if (ret == NULL) {          if (ret == NULL) {
             xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");              xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
             return;              return;
Line 2222  xmlSAX2StartElementNs(void *ctx, Line 2242  xmlSAX2StartElementNs(void *ctx,
         }          }
     }      }
   
    if ((ctxt->myDoc->children == NULL) || (parent == NULL)) {    if (parent == NULL) {
         xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);          xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
     }      }
     /*      /*
Line 2314  xmlSAX2StartElementNs(void *ctx, Line 2334  xmlSAX2StartElementNs(void *ctx,
      */       */
     if (nb_attributes > 0) {      if (nb_attributes > 0) {
         for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {          for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {
               /*
                * Handle the rare case of an undefined atribute prefix
                */
               if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) {
                   if (ctxt->dictNames) {
                       const xmlChar *fullname;
   
                       fullname = xmlDictQLookup(ctxt->dict, attributes[j+1],
                                                 attributes[j]);
                       if (fullname != NULL) {
                           xmlSAX2AttributeNs(ctxt, fullname, NULL,
                                              attributes[j+3], attributes[j+4]);
                           continue;
                       }
                   } else {
                       lname = xmlBuildQName(attributes[j], attributes[j+1],
                                             NULL, 0);
                       if (lname != NULL) {
                           xmlSAX2AttributeNs(ctxt, lname, NULL,
                                              attributes[j+3], attributes[j+4]);
                           xmlFree(lname);
                           continue;
                       }
                   }
               }
             xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1],              xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1],
                               attributes[j+3], attributes[j+4]);                               attributes[j+3], attributes[j+4]);
         }          }
     }      }
   
Line 2595  xmlSAX2ProcessingInstruction(void *ctx, const xmlChar  Line 2640  xmlSAX2ProcessingInstruction(void *ctx, const xmlChar 
         xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret);          xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret);
         return;          return;
     }      }
    if ((ctxt->myDoc->children == NULL) || (parent == NULL)) {    if (parent == NULL) {
 #ifdef DEBUG_SAX_TREE  #ifdef DEBUG_SAX_TREE
             xmlGenericError(xmlGenericErrorContext,              xmlGenericError(xmlGenericErrorContext,
                     "Setting PI %s as root\n", target);                      "Setting PI %s as root\n", target);
Line 2656  xmlSAX2Comment(void *ctx, const xmlChar *value) Line 2701  xmlSAX2Comment(void *ctx, const xmlChar *value)
         xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret);          xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret);
         return;          return;
     }      }
    if ((ctxt->myDoc->children == NULL) || (parent == NULL)) {    if (parent == NULL) {
 #ifdef DEBUG_SAX_TREE  #ifdef DEBUG_SAX_TREE
             xmlGenericError(xmlGenericErrorContext,              xmlGenericError(xmlGenericErrorContext,
                     "Setting xmlSAX2Comment as root\n");                      "Setting xmlSAX2Comment as root\n");

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>