Re: [xml] Remove whitespaces from text nodes

2012-02-15 Thread spam . spam . spam . spam
This solution works correctly, thank you. It strips leading and trailing whitespace. But now, I am wondering if there is a solution just using libxml2 (without libxslt). In fact, I am requesting for a transformation of the XML document. Indeed, the original node contains whitespaces and I want

Re: [xml] Remove whitespaces from text nodes

2012-02-15 Thread Liam R E Quin
On Wed, 2012-02-15 at 10:04 +0100, spam.spam.spam.s...@free.fr wrote: There is a solution using the libxslt library and applying a stylesheet to the document... But I am wondering if there is a way to do this job using just libxml2. Have you any idea about this? Use titleMy Book C/title

Re: [xml] Remove whitespaces from text nodes

2012-02-15 Thread Michael Ludwig
spam.spam.spam.s...@free.fr schrieb am 15.02.2012 um 10:00 (+0100): But now, I am wondering if there is a solution just using libxml2 (without libxslt). In fact, I am requesting for a transformation of the XML document. Indeed, the original node contains whitespaces and I want to remove

Re: [xml] Remove whitespaces from text nodes

2012-02-15 Thread spam . spam . spam . spam
No that's not what I want. As I said before, I don't want to edit the XML file. I have whitespaces in the XML file, it's a fact. Now I want to parse it with libxml2. There is a first solution which works correctly with libxslt. There is a second solution with SAX but I have not yet tested this

Re: [xml] Remove whitespaces from text nodes

2012-02-15 Thread Liam R E Quin
On Thu, 2012-02-16 at 08:28 +0100, spam.spam.spam.s...@free.fr wrote: [...]. Anyway, there seems to have no other solution with libxml2 only. The spaces are part of the text of the document, so it's not likely that a conformant XML parser will strip them for you. You could of course remove the

Re: [xml] Remove whitespaces from text nodes

2012-02-15 Thread spam . spam . spam . spam
Yes you are right. But I am not sure my function will do a good job. I know 2 whitespaces : , \t, ... But I am not sure that I know all of them. My function will probably forgot to strip some whitespaces... This is the reason why I would like to use an already defined function. Is there a