tiny fix in xmlSchemaValidateStream() if a user-provided SAX handler is

* xmlschemas.c: tiny fix in xmlSchemaValidateStream() if a
  user-provided SAX handler is given.
diff --git a/ChangeLog b/ChangeLog
index 2c630a4..db31770 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul  8 20:04:29 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+	* xmlschemas.c: tiny fix in xmlSchemaValidateStream() if a
+	  user-provided SAX handler is given.
+
 Fri Jul  8 19:25:26 CEST 2005 Daniel Veillard <daniel@veillard.com>
 
 	* parser.c: fix some potential leaks in error cases.
diff --git a/xmlschemas.c b/xmlschemas.c
index 7dbada0..fda957a 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -24295,7 +24295,7 @@
 
     memset(&schemas_sax, 0, sizeof(xmlSAXHandler));
     schemas_sax.initialized = XML_SAX2_MAGIC;
-    if (sax == NULL) {
+    if (sax == NULL) {	
         /*
 	 * go direct, no need for the split block and functions.
 	 */
@@ -24310,7 +24310,7 @@
 
 	schemas_sax.cdataBlock = xmlSchemaSAXHandleCDataSection;
 	schemas_sax.reference = xmlSchemaSAXHandleReference;
-	ctxt->user_data = &split_block;
+	/* ctxt->user_data = &split_block; */
     } else {
        /*
         * Return -1 without parsing if passed a SAXv1 block
@@ -24385,15 +24385,13 @@
         schemas_sax.reference = referenceSplit;
         schemas_sax.startElementNs = startElementNsSplit;
         schemas_sax.endElementNs = endElementNsSplit;
-	ctxt->user_data = &split_block;
-    }
-
-    split_block.user_sax = sax;
-    split_block.user_data = user_data;
+	/* ctxt->user_data = &split_block; */
+	split_block.user_sax = sax;
+	split_block.user_data = user_data;	
+    }    
     ctxt->input = input;
     ctxt->enc = enc;
     ctxt->sax = &schemas_sax;
-
     /*
      * prepare the parser
      */
@@ -24402,13 +24400,15 @@
         return (-1);
     old_sax = pctxt->sax;
     pctxt->sax = &schemas_sax;
-    pctxt->userData = &split_block;
+    if (sax == NULL)
+	pctxt->userData = (void *) ctxt;
+    else
+	pctxt->userData = &split_block;
 #if 0
     if (options)
         xmlCtxtUseOptions(pctxt, options);
 #endif
-    pctxt->linenumbers = 1;
-    pctxt->userData = (void *) ctxt;
+    pctxt->linenumbers = 1;    
 
     inputStream = xmlNewIOInputStream(pctxt, input, enc);;
     if (inputStream == NULL) {
@@ -24432,7 +24432,7 @@
     }    
     ctxt->parserCtxt = NULL;
     ctxt->sax = NULL;
-    ctxt->user_data = NULL;
+    /* ctxt->user_data = NULL; */
     ctxt->input = NULL;
 
 done: