Click here to Skip to main content
15,893,722 members
Home / Discussions / C#
   

C#

 
GeneralRe: Save and Save as Pin
squerley4-Dec-10 16:08
squerley4-Dec-10 16:08 
GeneralRe: Save and Save as Pin
_Erik_6-Dec-10 23:35
_Erik_6-Dec-10 23:35 
GeneralRe: Save and Save as Pin
squerley10-Dec-10 15:46
squerley10-Dec-10 15:46 
QuestionHow to delete word field code from C# Pin
Andraw Tang2-Dec-10 8:45
Andraw Tang2-Dec-10 8:45 
QuestionXPathNavigator iterate and write Pin
Mark F.2-Dec-10 5:38
Mark F.2-Dec-10 5:38 
AnswerRe: XPathNavigator iterate and write Pin
cechode2-Dec-10 13:15
cechode2-Dec-10 13:15 
GeneralRe: XPathNavigator iterate and write [modified] Pin
Mark F.3-Dec-10 9:00
Mark F.3-Dec-10 9:00 
AnswerRe: XPathNavigator iterate and write Pin
cechode3-Dec-10 9:34
cechode3-Dec-10 9:34 
of course not. ( there are several ways as you'd expect, heres one, not the best not the worst )
how's this ?
static void Main(string[] args)
{
    string newFileName = "c:\\myfilename.xml";

    XmlDocument docSource = new XmlDocument();
    docSource.LoadXml(XML);
    Reorder(docSource.DocumentElement);
    docSource.Save(newFileName);
}


private static void Reorder(XmlNode node)
{
    SortedList<string, XmlNode> childlist = SortedChildNodes(node);
    node.RemoveAll();
    for (int i = 0; i < childlist.Count; i++)
    {
        Reorder(node.AppendChild(childlist.Values[i]));
    }

}
static SortedList<string, XmlNode> SortedChildNodes(XmlNode node)
{
    SortedList<string, XmlNode> ret = new SortedList<string, XmlNode>();
    for (int i = 0; i < node.ChildNodes.Count; i++)
    {
        string name = node.ChildNodes[i].Name;
        XmlNode nd = node.ChildNodes[i];
        ret.Add(name, nd);
    }
    return ret;
}

QuestionAvoid Peer 2 Peer acces Pin
utunity2-Dec-10 5:08
utunity2-Dec-10 5:08 
AnswerRe: Avoid Peer 2 Peer acces Pin
musefan2-Dec-10 5:36
musefan2-Dec-10 5:36 
GeneralRe: Avoid Peer 2 Peer acces Pin
utunity2-Dec-10 5:45
utunity2-Dec-10 5:45 
GeneralRe: Avoid Peer 2 Peer acces Pin
musefan2-Dec-10 5:51
musefan2-Dec-10 5:51 
GeneralRe: Avoid Peer 2 Peer acces Pin
Luc Pattyn2-Dec-10 7:48
sitebuilderLuc Pattyn2-Dec-10 7:48 
GeneralRe: Avoid Peer 2 Peer acces Pin
fjdiewornncalwe3-Dec-10 1:15
professionalfjdiewornncalwe3-Dec-10 1:15 
AnswerRe: Avoid Peer 2 Peer acces Pin
T M Gray2-Dec-10 11:08
T M Gray2-Dec-10 11:08 
QuestionFlickering Pin
peropata2-Dec-10 3:43
peropata2-Dec-10 3:43 
AnswerRe: Flickering Pin
musefan2-Dec-10 3:52
musefan2-Dec-10 3:52 
AnswerRe: Flickering Pin
phil.o2-Dec-10 4:07
professionalphil.o2-Dec-10 4:07 
GeneralRe: Flickering Pin
musefan2-Dec-10 4:11
musefan2-Dec-10 4:11 
GeneralRe: Flickering [modified] Pin
phil.o2-Dec-10 4:46
professionalphil.o2-Dec-10 4:46 
GeneralRe: Flickering Pin
Luc Pattyn2-Dec-10 4:54
sitebuilderLuc Pattyn2-Dec-10 4:54 
GeneralRe: Flickering Pin
phil.o2-Dec-10 5:02
professionalphil.o2-Dec-10 5:02 
GeneralRe: Flickering Pin
musefan2-Dec-10 5:11
musefan2-Dec-10 5:11 
GeneralRe: Flickering Pin
peropata2-Dec-10 5:38
peropata2-Dec-10 5:38 
GeneralRe: Flickering Pin
Luc Pattyn2-Dec-10 6:43
sitebuilderLuc Pattyn2-Dec-10 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.