There are multiple root elements
More than one element at the top level: an XML document has exactly one root.
There are multiple root elements. Line 2, position 2.
Why it happens
- Several documents or records concatenated without a wrapping element.
- An end tag for the root that comes too early.
How to fix it
Wrap the elements in one root element. To read a stream of fragments on purpose, set XmlReaderSettings.ConformanceLevel = ConformanceLevel.Fragment.
.NET throws an XmlSchemaValidationException at the first schema error unless XmlReaderSettings.ValidationEventHandler is set, which then receives every one with its line and position. A well-formedness error is an XmlException and ends reading whatever the settings.
The same problem in xmlvalid
xmlvalid validates with libxml2, which reports it as Extra content at the end of the document. It checks the whole document in your browser and lists every schema error with its line and column, not only the first.
Extra content at the end of the document
Example
<note/>
<note/>
<notes>
<note/>
<note/>
</notes>