Please see the sample xml given below. As per a requirement, I need to have a similar structure. Could someone verify if this is valid XML.
<?xml version="1.0" encoding="UTF-8"?>
<book>
<name>name1</name>
<price>price1</price>
</book>
<book>
<name>name2</name>
<price>price2</price>
</book>
<book>
<name>name3</name>
<price>price3</price>
</book>
It isn’t.
An XML document must have a single root element.
i.e. the element you open first must be the element you close last.
The first element you open is
bookon line 2. You close it on line 5. On line 6 you open anotherbook.You probably want to wrap all the
bookelements with abookselement or alibraryelement.