GÉRER L'INDENTATION D'UN FLUX XML

TheSaib Messages postés 2367 Date d'inscription mardi 17 avril 2001 Statut Membre Dernière intervention 26 décembre 2007 - 14 janv. 2004 à 00:35
k_wa Messages postés 32 Date d'inscription lundi 6 novembre 2000 Statut Membre Dernière intervention 20 septembre 2006 - 6 sept. 2006 à 13:52
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/19314-gerer-l-indentation-d-un-flux-xml

k_wa Messages postés 32 Date d'inscription lundi 6 novembre 2000 Statut Membre Dernière intervention 20 septembre 2006
6 sept. 2006 à 13:52
pour répondre à TheSaib, effectivement...:

using (StringWriter body = new StringWriter())
{
XmlWriterSettings set = new XmlWriterSettings();
set.Indent = true;
set.Encoding = Encoding.UTF8;
using (XmlWriter writer = XmlWriter.Create(body, set))
{
// insert code here
}
}
TheSaib Messages postés 2367 Date d'inscription mardi 17 avril 2001 Statut Membre Dernière intervention 26 décembre 2007 23
14 janv. 2004 à 00:35
Ce n'est pas pour être desobligeant mais je crois qu'il y a une classe préfaite pour indenter les Fichiers XML dans le framework ...

Je verifierais a l'occasion ;)
Rejoignez-nous