-1

I have this xml document.

<response>
    <metadata>
        <iserror>false</iserror>
        <start>1</start>
        <startdate>10/20/2014</startdate>
        <enddate>10/21/2014</enddate>
        <breakdownby>day</breakdownby>
        <orderby>date</orderby>
        <ordertype>asc</ordertype>
        <domainname>
            <![CDATA[ domainname.com ]]>
        </domainname>
    </metadata>
    <results first="1" last="2" total="2">
        <result>
            <year>2014</year>
            <month>10</month>
            <day>03</day>
            <sales>1</sales>
            <profit>1.08</profit>
         </result>
         <result>
            <year>2014</year>
            <month>10</month>
            <day>04</day>
            <sales>4</sales>
            <profit>5.79</profit>
         </result>
    </results>
</response>

I want to display this xml in my html page. But before that I want to make some changes to it. I want that the profit is doubled on the html page. I need help with modifying the data and then putting it as html.

any simple way to achieve this?

surya
  • 1
  • 1
  • You can do it without php using a [XSLT](https://www.google.com/webhp?#q=xslt) –  Oct 21 '14 at 19:16
  • DO you mean you want to display the XML AS XML on your page or is there some different HTML construct you want to populate the XML data into? – Mike Brant Oct 21 '14 at 19:18
  • *"any simple way to achieve this?"* does not really qualify as a programming question for this Q&A site. Please formulate a clear problem statement. Literally there are a thousand ways to do what could possibly match with your vague requirements. The short answer is: You could do that with programming. So what is your *next* question? – hakre Oct 21 '14 at 19:18
  • @hakre I meant to ask the simplest method "you" know. PS: you did not understand what I meant to ask. kindly do not show off. Thank you. :) – surya Oct 21 '14 at 22:13
  • I didn't show off. And indeed I did answer with the simplest method I know, see the duplicate. Additionally I asked you for your *next* question. – hakre Oct 22 '14 at 12:19

1 Answers1

0

Look at the SimpleXML Class. This is the easiest way to go.

Markus
  • 440
  • 2
  • 10
  • That worked. I used SimpleXMLElements but the code is not working on my server so I am still on it. thanks – surya Oct 22 '14 at 07:23