I have a list of codes to which i have an error \"XML document cannot contain multiple root level elements\"
J
Assuming what you want to do is open the document anyway, you can set the ConformanceLevel
of the XmlReader
to ConformanceLevel.Fragment
.
XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
// input is a stream or filename
using (XmlReader reader = XmlReader.Create(input, settings)) {
// use the reader
}