Skip to content
Advertisement

How to display the attributes of an XML file to a website?

I want to display the data of an XML file to my website, I have a problem for displaying that, because XML file is a bit different. I have to dispaly the value of certain attributes of this XML file. the path of this XML file is stored in side the database. the data which should be displayed I marked as bold(inside double star). Thank you all so much for helping me. I need an example please.

here the xml file:

JavaScript

Advertisement

Answer

To accomplish the goal of displaying various Attributes from some XML data using PHP the most common method would be to use DOMDocument and DOMXPath

The following uses an array to aid processing the various queries needed. This is just the way I chose to approach the issue – not necessarily how one must do it.

JavaScript

This will output:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement