while creating an xml file from another one by cloning nodes from source to target file in c#, the structure of empty nodes like <noeud></noeud>
becomes <noeud/>
i've tried this :
if (nodeSource.InnerText.Equals(""))
XmlNode nodeDestination = NodeSource.CloneNode(false);
is there any method to keep the same structure .
The format <element/>
is frequently called a self-closing element. It's 100% valid, and the preferred storage method. If you really care (why?) re-writing to expanded format (<element></element>
), you can look at writing your own XmlTextWriter. This article will be helpful for you.