[xml] \n or \r missing when adding text-content



Hi list,

I'm currently working on an xml C program and I choosed to use libxml2. Everything went good till I encounter a little problem.
In fact, I have the following tree, for example :

/<?xml version="1.0"?>
<root>
 <PORSCHE>
   <Production Annee="1992" Type="964">
     <Version Modele="Carrera RS" Puissance="260"/>
     <Version Modele="Turbo 3.6" Puissance="360"/>
   </Production>
   <Production Annee="1995" Type="993">
     <Version Modele="Turbo" Puissance="408">
       <Evolution Modele="GT2" Puissance="450"/>
     </Version>
   </Production>
 </PORSCHE>
</root>/


I dump it by 2 differents ways, 2 distinct libxml2 base functions. But I tried to add some text to a node, like that :

/  <Version Modele="Turbo 3.6" Puissance="360">
   Bad boys version
  </Version>

/I used xmlNewText and also xmlNodeAddContent, but still the same problem :


/<?xml version="1.0"?>
<root>
 <PORSCHE>Exemple de texte
<Production Annee="1992" Type="964"><Version Modele="Carrera RS" Puissance="260"/><Version Modele="Turbo 3.6" Puissance="360"/></Production><Production Annee="1995" Type="993"><Version Modele="Turbo" Puissance="408"><Evolution Modele="GT2" Puissance="450"/></Version></Production></PORSCHE>
</root>/


All the \n or the \n seem to be missing. How can I add some content and keep the first form ? Almost each node in the project I'm currently working on need text content.

Thanks a lot,

Best regards,

--
_____________________________________________
Remy HAREL          -        Teamlog        |
____________________________________________|
Linux registered user #224740               |
France Telecom Recherche & Developpement    |
____________________________________________| __________________@ http://www.chezrem.org @|





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]