Re: [xml] Remove whitespaces from text nodes
- From: Laurence Rowe <l lrowe co uk>
- To: spam spam spam spam free fr
- Cc: xml gnome org
- Subject: Re: [xml] Remove whitespaces from text nodes
- Date: Tue, 14 Feb 2012 20:58:37 +0000
On 14 February 2012 09:59, <spam spam spam spam free fr> wrote:
Hello,
I write a C program using the libxml2 library.
It takes as argument an input XML file and it displays the content at the screen.
This is the input file :
<library name="library of UM2">
<book name="Design Patterns: Elements of Reusable Object-Oriented Software"
author="Erich Gamma"
editor="Addison Wesley"
isbn="9780201633610">
My book "A"
</book>
<book name="Computer Networks"
author="Andrew S. Tanenbaum"
editor="Prentice Hall"
isbn="9780133499452">
My book "B"
</book>
<book name="Introduction to Algorithms"
author="Thomas H. Cormen"
editor="MIT Press"
isbn="9780262033848">
My book "C"
</book>
</library>
This is the output :
$ src/xmlnodelistgetstring data/data.xml
"
My book "A"
"
"
My book "B"
"
"
My book "C"
"
I would like to have this output (without editing my XML file) :
"My book "A""
"My book "B""
"My book "C""
The useless whitespaces are removed from text nodes.
Is there a function which do this work?
Take a look at the xmllint source, it has a --noblanks option which
sets xmlKeepBlanksDefault(0);
Laurence
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]