4 Replies Latest reply on Jun 20, 2006 5:23 PM by SafariTECH

    XML attribute IsDefined

    El_Crabs
      Ahoy there.

      I am in the process of building an RSS slice n dicer. The script pulls an rss feed in from afar, processes the nodes and then slots them into a database. Simple. Nearly done infact. Except for one problem. The people who generate the rss, have left out the some of the regular attributes toward the end of the file. Very annoying. So on processing node 635, the scipt looks for attribute Z (which every other node has) but falls over when one is not found. Is there a way to catch this and then continue processing? I tried IsDefined, and IsXmlAttribute (which doesnt work as the server is cf version 5) but no luck.
      Would a TRY . . . CATCH block work? I dont even know if Coldfusion has those but thats the only other thing I can think of, though messy. If anyone has an a solution, pls come fourth and share. Thanks a bunch.

      ROUGH XML example:
      <root>
      <row x="1" y="2" z="3"/>
      <row x="1" y="2" z="3"/>
      <row x="1" y="2" z="3"/>
      <row x="1" y="2" /> /* THIS NODE IS MISSING THE 'Z' ATTRIBUTE, CAUSING MY LOOP TO KEEL OVER DRAMATICALLY */
      </root>