Re: Ignoring blank spaces in SOAP

Fernando Herrera <[email protected]> Wed, 7 Jul 2004 04:45:57 +0200
Newsgroups gmane.comp.gnome.ximian.soup
Message-ID <[email protected]>
--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

Tue, Jul 06, 2004 at 12:51:14PM -0400, Dan Winship escribió:

>> +       xmlKeepBlanksDefault (0);
>
>Unfortunately, that changes the behavior of libxml for all callers in
>the entire app, which might break something else. We need to make the
>SOAP-parsing code deal with the blank nodes itself.

	What about using a parse context? Attached patch

Salu2

-- 
Fernando Herrera de las Heras
Onírica: análisis, diseño e implantación de soluciones informáticas
http://www.onirica.com

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="libsoup-xmlctxt.patch"

Index: soup-soap-response.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-soap-response.c,v
retrieving revision 1.12
diff -u -u -r1.12 soup-soap-response.c
--- soup-soap-response.c	18 Feb 2004 15:00:34 -0000	1.12
+++ soup-soap-response.c	7 Jul 2004 02:43:00 -0000
@@ -15,6 +15,7 @@
 struct _SoupSoapResponsePrivate {
 	/* the XML document */
 	xmlDocPtr xmldoc;
+	xmlParserCtxtPtr ctxt;
 	xmlNodePtr xml_root;
 	xmlNodePtr xml_body;
 	xmlNodePtr xml_method;
@@ -34,6 +35,11 @@
 		xmlFreeDoc (response->priv->xmldoc);
 		response->priv->xmldoc = NULL;
 	}
+	if (response->priv->ctxt) {
+		xmlFreeParserCtxt (response->priv->ctxt);
+		response->priv->ctxt = NULL;
+	}
+	
 
 	response->priv->xml_root = NULL;
 	response->priv->xml_body = NULL;
@@ -66,6 +72,7 @@
 {
 	response->priv = g_new0 (SoupSoapResponsePrivate, 1);
 
+	response->priv->ctxt = xmlNewParserCtxt ();
 	response->priv->xmldoc = xmlNewDoc ("1.0");
 }
 
@@ -153,7 +160,7 @@
 		old_doc = response->priv->xmldoc;
 
 	/* parse the string */
-	response->priv->xmldoc = xmlParseMemory (xmlstr, strlen (xmlstr));
+	response->priv->xmldoc = xmlCtxtReadMemory (response->priv->ctxt, xmlstr, strlen (xmlstr), NULL, NULL, XML_PARSE_NOBLANKS);
 	if (!response->priv->xmldoc) {
 		response->priv->xmldoc = old_doc;
 		return FALSE;

--k+w/mQv8wyuph6w0--
_______________________________________________
Soup-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/soup-list