4 Replies Latest reply on Mar 19, 2007 12:42 PM by Anthony Spears

    Looping through xml in cfscript

    Anthony Spears Level 1
      Ok, I can loop through xml to get the value of any tag and output it to a variable. But the problem for me is getting the child tags of a specific tag to loop out grouped together. For instance, below I would want to group the xml like this.

      Year: 90
      Employer: Bank
      Wages: 2000.00

      Year: 90
      Employer: Gas Station
      Wages: 1000.00

      Ok, I can loop through xml to get the value of any tag and output it to a variable. But the problem for me is getting the child tags of a specific tag to loop out grouped together. For instance, below I would want to group the xml like this.

      Year: 91
      Employer: Bank
      Wages: 2500.00

      Year: 91
      Employer: Gas Station
      Wages: 1500.00


      <year value="90">
      <employer name="bank">
      <wages>2000.00</wages>
      </employer>
      <employer name="gas station">
      <wages>1000.00</wages>
      </employer>
      </year>

      <year value="91">
      <employer name="bank">
      <wages>2500.00</wages>
      </employer>
      <employer name="gas station">
      <wages>1500.00</wages>
      </employer>
      </year>

      Thanks in advanced,

      Anthony