Author: gstein
Date: Wed Jun 13 11:21:35 2012
New Revision: 1349757

URL: http://svn.apache.org/viewvc?rev=1349757&view=rev
Log:
Implement the new streaming cdata callback. This will be used by
blame, replay, and update.

* subversion/libsvn_ra_serf/xml.c:
  (svn_ra_serf__xml_cb_cdata): use the CDATA_CB as appropriate

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/xml.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/xml.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/xml.c?rev=1349757&r1=1349756&r2=1349757&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/xml.c Wed Jun 13 11:21:35 2012
@@ -751,11 +751,29 @@ svn_ra_serf__xml_cb_cdata(svn_ra_serf__x
                           const char *data,
                           apr_size_t len)
 {
-  /* If we're collecting cdata, but NOT waiting for a closing tag
-     (ie. not within an unknown tag), then copy the cdata.  */
-  if (xmlctx->current->cdata != NULL
-      && xmlctx->waiting.namespace == NULL)
-    svn_stringbuf_appendbytes(xmlctx->current->cdata, data, len);
+  /* If we are waiting for a closing tag, then we are uninterested in
+     the cdata. Just return.  */
+  if (xmlctx->waiting.namespace != NULL)
+    return SVN_NO_ERROR;
+
+  /* If the current state is collecting cdata, then copy the cdata.  */
+  if (xmlctx->current->cdata != NULL)
+    {
+      svn_stringbuf_appendbytes(xmlctx->current->cdata, data, len);
+    }
+  /* ... else if a CDATA_CB has been supplied, then invoke it for
+     all states.  */
+  else if (xmlctx->cdata_cb != NULL)
+    {
+      START_CALLBACK(xmlctx);
+      SVN_ERR(xmlctx->cdata_cb(xmlctx->current,
+                               xmlctx->baton,
+                               xmlctx->current->state,
+                               data, len,
+                               xmlctx->scratch_pool));
+      END_CALLBACK(xmlctx);
+      svn_pool_clear(xmlctx->scratch_pool);
+    }
 
   return SVN_NO_ERROR;
 }


Reply via email to