Pranav P

Pranav P

  • NA
  • 45
  • 1.1k

reading xml document as attribute name and attirbute value

Jun 28 2019 5:11 AM
 from the given piece of  xml document
 
 
<bookstore>
<book category="COOKING">
<title >Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
 
 
how to read the attributes names and their values  from an xml document as the given format below
 
 
 
{category:'COOKING',title:'Everyday Italian',author: 'Giada De Laurentiis',year: '2005',price:'30.00'}
{category:'CHILDREN',title:'Harry Potter',author: 'J K. Rowling',year: '2005',price:'29.99'} 
 
 
is there any sample code that i can refer ?
thanks in advance. 
 
 

Answers (3)