3 Replies Latest reply on Apr 12, 2007 10:05 AM by Anthony Spears

    Looping through xml

    Anthony Spears Level 1
      This is the situation. I am parsing xml and putting it into a cfquery.

      This is the basic structure of the xml

      <year count=1 value=90>
      <tag1>300</tag1>
      <tag2>400</tag2>
      </year>

      <year value=91>
      <tag1>100</tag1>
      <tag2>200</tag2>
      </year>

      <year value=92>
      <tag1>500</tag1>
      </year>

      Tag1 will always exist and Tag2 only sometimes

      I am looping through the xml and putting it into a query which looks pretty much like this.

      Year Tag1 Tag2

      How do I detect to see if tag2 exists under each year tag and then insert the value into the query or put zero into the query when it doesn't exist?

      Thanks in advance.