Problem Text :

Write a function ReadXml($xmlstr) which accepts an XML string as its only argument. Your function should write the names of the nodes and their values.

For Example :

ReadXml($xmlstr) where
$xmlstr= ‘<Address><to>James</to><from>Jani</from><heading>Reminder</heading><body>Please check your mail.</body></Address>’

should return

Address
to: James
from: Jani
heading: Reminder
body: Please check your mail.

Note: As the question requires the output to be displayed in the new/ next line, use “\n” instead of “<br>”

Please Share your Answer in Comment Box:

You must be logged in to post a comment.