tags:

views:

135

answers:

0

I want to parse an XML alongwith the inner XML. I will explain the same with an example:

  <convert from="deg C" to="DegF">
    <function name="add">
  <function name="multiply">
        <function name="divide">
          <param value="9"/>
          <param value="5"/>
        </function>
        <input id="deg C"/>
      </function>
      <param value="32"/>
    </function>
  </convert>

I need to parse the above XML and store it in an object which holds 1. convertFrom, 2. convertTo and 3. function (I want the whole function tag to be stored in variable as it is.)

I am using W3C DOM parser for the purpose. I was able to extract convertFrom and convertTo field but the inner XML function is giving problems. Any inputs how to go about parsing the inner XML as it is.