Error parsing XML: junk after document element [How to Solve]

Many developers may prompt Error parsing XML: junk after document element when writing an XML layout file. Here, Android123 reminds everyone that a valid XML file has only one main root node, such as

<android123>
<item1/>
<item2/>
<item3/>
</android123>

If there is an error like Error parsing XML: junk after document element, your idea may be as long as the main root has multiple nodes, for example

<android123>
<item1/>
</android123>
<android123>
<item2/>
<item3/>
</android123>

 

 

The xml cannot be parsed. The reason may be that the xml format is written incorrectly. Consider that the root node is incorrect.

Similar Posts: