Bonjour,

Je suis confronté à un petit problème avec la manipulation des flux xml...
Je voudrais à partir d'une string récupérée en DB :
- La charger dans un XmlDocument : OK avec un textReader.
- La modifier : OK grâce à XpathNavigator et XpathNodeNavigator
- renvoyer la chaine modifée sous forme de string : C'est la que ca bloque.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
            TextReader reader = new StringReader(filter.Value);
            XmlDocument xmlDoc = new XmlDocument();
 
            xmlDoc.Load(reader);
            XPathNavigator xPathNavigator = xmlDoc.CreateNavigator();
            string strExp = "Mon Expression XPath";
 
            XPathNodeIterator nodes  = xPathNavigator.Select(xPathNavigator.Compile(strExp));
 
            while (nodes.MoveNext())
            {
                nodes.Current.MoveToAttribute("value", "");
                string strValue = nodes.Current.Value.ToString();
                strValue = ModifMaValue(strValue);
                nodes.Current.SetValue(strValue);
            }
            //Récupération de la chaine modifée...
            //Je vois pas trop comment faire...
            XmlTextWriter writer;
            xmlDoc.WriteTo(writer);
            writer.Formatting = Formatting.Indented;
            return...
Ce bout de code est, je pense assez explicatif.
Je bloque après la modification de mon fichier, je ne sais pas comment récupérer la valeur de la chaine.

D'avance Merci et ...Bon Week-End