Tout commence pas une banale discussion sur MSN avec mon ami JB …
jb :: dit :
ce batard de patrice
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
koi
jb :: dit :
c'est moi qui lui ai montre comment on faisait pour afficher de l xml indente
jb :: dit :
parce qu il y arrivait pas
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
?
jb :: dit :
et meme pas il me cite ou il me dit merci
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
cad
jb :: dit :
lis son blog
jb :: dit :
il affiche du xml
jb :: dit :
il recevait une string, qui contenait du xml
jb :: dit :
et il voulait re avoir une string
jb :: dit :
mais avec le xml correctement formate
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
pour son appli
jb :: dit :
et il y arrivait pas
jb :: dit :
oui
jb :: dit :
alors je lui ai fais en deux deux
jb :: dit :
et meme pas il me remercie
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
c koi le truc
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
un fonction recursive ?
jb :: dit :
StringWriter sw = new StringWriter ();
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
et?
jb :: dit :
XmlTextWriter xmltxt = new XmlTextWriter ();
jb :: dit :
// tu me laisses taper oui ?
jb :: dit :
XmlDocument doc = new XmlDocument ();
jb :: dit :
doc.LoadXml (ma_string_d_origine);
jb :: dit :
// fuck je me suis trompe
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
//lol
jb :: dit :
xmltxt = new XmlTextWriter (sw); xmltxt.Formatting = Formatting.Indented;
jb :: dit :
// il faut lire la haut
jb :: dit :
// je redescend en bas
jb :: dit :
doc.Save (xmltxt);
jb :: dit :
string my_new_string = sw.ToString ();
jb :: dit :
// et voila
jb :: dit :
// spa pratique dans msn
Evilz : 27 ou 28 Paintball envoyez moi un mail si vous voulez venir dit :
pas mal
jb :: dit :
oep
Donc je résume pour ceux qui n’arriveraient pas à suivre :
StringWriter sw = new StringWriter ();
XmlTextWriter xmltxt = new XmlTextWriter (sw);
xmltxt.Formatting = Formatting.Indented;
XmlDocument doc = new XmlDocument ();
doc.LoadXml (ma_string_d_origine);
xmltxt = doc.Save (xmltxt);
string my_new_string = sw.ToString ();