Writing XML in C# - 'Token StartElement in state Epilog would result in an invalid XML document' error

后端 未结 2 545
Happy的楠姐
Happy的楠姐 2021-01-12 06:32

I\'m trying to write to an XML document, taking data from an ArrayList of lists

        for (int i = 0; i < 15; i++)
        {
            string headname         


        
2条回答
  •  逝去的感伤
    2021-01-12 07:14

    An XML document will have a root element ie one that includes all other elements. You don't have one

    Your doc is like

    
    
    

    An XML doc is like

    
        
        
    
    

    You need to WriteStartElement and WriteEndElement around your loop

提交回复
热议问题