[xml] patch: xmlTextReaderGetAttribute



attached is patch for xmlTextReaderGetAttribute.
Using the following document
<chapter xmlns:a="http://www.example.com/namespace-a";>
  <a:section a:id="about" id="2" />
</chapter>

calling xmlTextReaderGetAttribute('id') when positioned on section element returns the value "about" instead of "2". It takes a qualified name as a parameter so should not grab a namespaced attribute.
With patch it works just like xmlTextReaderMoveToAttribute.

Also removed the check on localname being NULL as its not needed. A NULL localname is handled and function returned prior to this point.

Rob

Index: xmlreader.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmlreader.c,v
retrieving revision 1.123
diff -c -r1.123 xmlreader.c
*** xmlreader.c 29 Jul 2005 22:02:23 -0000      1.123
--- xmlreader.c 8 Aug 2005 03:18:12 -0000
***************
*** 2310,2323 ****
  
      localname = xmlSplitQName2(name, &prefix);
      if (localname == NULL)
!       return(xmlGetProp(reader->node, name));
      
      ns = xmlSearchNs(reader->node->doc, reader->node, prefix);
      if (ns != NULL)
          ret = xmlGetNsProp(reader->node, localname, ns->href);
  
!     if (localname != NULL)
!         xmlFree(localname);
      if (prefix != NULL)
          xmlFree(prefix);
      return(ret);
--- 2310,2322 ----
  
      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)
          xmlFree(prefix);
      return(ret);


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