0

I'm writing a small program that gets user input about books, processes the information as book objects. Then, it exports the data to an XML file

Currently, I'm getting this output

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<booklist>
    <book>
        <title>Hunger Games</title>
        <price>9.99</price>
        <description>Description paragraph one
            Description paragraph two
            Description paragraph</description>
    </book>
    <book>
        <title>Catching Fire</title>
        <price>9.99</price>
        <description>Description paragraph one
            Description paragraph two
            Description paragraph three</description>
    </book>
</booklist>

If you look closely, you will see tha the description doesnt look right. When I load the file, my code reads the data perfectly, and has no problem build the objects. However, I would like my description tag to have an extra new line after the openning tag and before the clossing tag, without modifying the objects description. How do I do that?

Priyanka
  • 169
  • 3
  • 10

1 Answers1

0

I can see you are printing Book two times in the output. first one seems to be correct. Can you please check the code why in second time it is printing in different format.

Can you also share the code snippet for same.

Sandeepjn
  • 181
  • 1
  • 1
  • 7