2007.
[idzebra-moved-to-github.git] / index / xmlread.c
index a75ef3c..2be8b94 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id: xmlread.c,v 1.1 2006-07-03 14:27:09 adam Exp $
-   Copyright (C) 1995-2005
+/* $Id: xmlread.c,v 1.4 2007-01-15 15:10:17 adam Exp $
+   Copyright (C) 1995-2007
    Index Data ApS
 
 This file is part of the Zebra server.
@@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra.  If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
 */
 
 #if HAVE_EXPAT_H
@@ -156,11 +156,11 @@ static void cb_entity_decl (void *userData, const char *entityName,
     
 }
 
-static int cb_external_entity (XML_Parser pparser,
-                               const char *context,
-                               const char *base,
-                               const char *systemId,
-                               const char *publicId)
+static int cb_external_entity(XML_Parser pparser,
+                              const char *context,
+                              const char *base,
+                              const char *systemId,
+                              const char *publicId)
 {
     struct user_info *ui = (struct user_info*) XML_GetUserData(pparser);
     FILE *inf;
@@ -392,9 +392,10 @@ static void cb_ns_end(void *userData, const char *prefix)
     if (prefix)
        yaz_log(ui->loglevel, "cb_ns_end %s", prefix);
 }
-data1_node *zebra_read_xml (data1_handle dh,
-                            int (*rf)(void *, char *, size_t), void *fh,
-                            NMEM m)
+
+data1_node *zebra_read_xml(data1_handle dh,
+                           struct ZebraRecStream *stream,
+                           NMEM m)
 {
     XML_Parser parser;
     struct user_info uinfo;
@@ -434,7 +435,7 @@ data1_node *zebra_read_xml (data1_handle dh,
             yaz_log (YLOG_WARN, "XML_GetBuffer fail");
             break;
         }
-        r = (*rf)(fh, buf, XML_CHUNK);
+        r = stream->readf(stream, buf, XML_CHUNK);
         if (r < 0)
         {
             /* error */
@@ -484,9 +485,9 @@ struct xml_info {
     XML_Expat_Version expat_version;
 };
 
-static data1_node *grs_read_xml (struct grs_read_info *p)
+static data1_node *grs_read_xml(struct grs_read_info *p)
 {
-    return zebra_read_xml (p->dh, p->readf, p->fh, p->mem);
+    return zebra_read_xml(p->dh, p->stream, p->mem);
 }
 
 static void *filter_init(Res res, RecType recType)