[xml] patch: xmlTextReaderGetAttribute and xmlns support



Patch adds support to retrieve value of namesapce delcarations in xmlTextReaderGetAttribute

Any objections to adding xmlns support to xmlTextReaderGetAttributeNs and xmlTextReaderMoveToAttributeNs?

Lastly is there any standard used on code indenting? I've noticed that sometimes spaces are used and further indenting is done with tabs.
I've just been using tabs.

Rob
Index: xmlreader.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmlreader.c,v
retrieving revision 1.124
diff -c -r1.124 xmlreader.c
*** xmlreader.c 8 Aug 2005 07:45:23 -0000       1.124
--- xmlreader.c 16 Aug 2005 11:09:17 -0000
***************
*** 2309,2320 ****
        return(NULL);
  
      localname = xmlSplitQName2(name, &prefix);
!     if (localname == NULL)
!       return(xmlGetNoNsProp(reader->node, name));
!     
!     ns = xmlSearchNs(reader->node->doc, reader->node, prefix);
!     if (ns != NULL)
!         ret = xmlGetNsProp(reader->node, localname, ns->href);
  
      xmlFree(localname);
      if (prefix != NULL)
--- 2309,2348 ----
        return(NULL);
  
      localname = xmlSplitQName2(name, &prefix);
!     if (localname == NULL) {
!               /*
!                * Namespace default decl
!                */
!               if (xmlStrEqual(name, BAD_CAST "xmlns")) {
!                       ns = reader->node->nsDef;
!                       while (ns != NULL) {
!                               if (ns->prefix == NULL) {
!                                       return(xmlStrdup(ns->href));
!                               }
!                               ns = ns->next;
!                       }
!                       return NULL;
!               }
!               return(xmlGetNoNsProp(reader->node, name));
!       }
! 
!     /*
!      * Namespace default decl
!      */
!     if (xmlStrEqual(prefix, BAD_CAST "xmlns")) {
!               ns = reader->node->nsDef;
!               while (ns != NULL) {
!                       if ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localname))) {
!                               ret = xmlStrdup(ns->href);
!                               break;
!                       }
!                       ns = ns->next;
!               }
!     } else {
!               ns = xmlSearchNs(reader->node->doc, reader->node, prefix);
!               if (ns != NULL)
!                       ret = xmlGetNsProp(reader->node, localname, ns->href);
!       }
  
      xmlFree(localname);
      if (prefix != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]