Voilà
Dans un autre endroit, je voudrais rajouter un parent pour avoir un xml :Code:
1
2
3
4 XmlDocument m_xmlCondition; m_xmlCondition = new XmlDocument(); m_xmlCondition.LoadXml("<fils/>")
<parent><fils/></parent>.
Comment fait on cela ?
Version imprimable
Voilà
Dans un autre endroit, je voudrais rajouter un parent pour avoir un xml :Code:
1
2
3
4 XmlDocument m_xmlCondition; m_xmlCondition = new XmlDocument(); m_xmlCondition.LoadXml("<fils/>")
<parent><fils/></parent>.
Comment fait on cela ?
Par exemple :
Code:
1
2
3
4
5
6 XmlDocument m_xmlcondition = new XmlDocument(); m_xmlcondition.LoadXml("<fils/>"); XmlNode _child = m_xmlcondition.FirstChild; XmlNode _parent = m_xmlcondition.CreateElement("Nom"); _parent.AppendChild(_child);
? :roll:Code:
1
2
3 XmlDocument m_xmlCondition = new XmlDocument(); m_xmlCondition.LoadXml("<parent><fils/></parent>");
Merci Kaidan, mon exemple simpliste mais son application réelle est plus compliqué donc :)
Pour Pontgen, en fait il manque une ligne, la solution est :MerciCode:
1
2
3
4
5
6 XmlDocument m_xmlcondition = new XmlDocument(); m_xmlcondition.LoadXml("<fils/>"); XmlNode _child = m_xmlcondition.FirstChild; XmlNode _parent = m_xmlcondition.CreateElement("parent"); _parent.AppendChild(_child); m_xmlcondition.AppendChild(_parent);