1 Reply Latest reply on Apr 2, 2011 5:08 PM by cfwild

    xml parse

    kt03 Level 1

      i have the xml file just like three tables below

      XML NameMT
      XMLNSPrefix
      XMLNsURI
      XMLText
      XMLcomment
      XMLAttributes
      Struct
      NID
      V100

       

      XML NameMT
      XMLNSPrefix
      XMLNsURI
      XMLText
      XMLcomment
      XMLAttributes
      Struct
      Ntitle
      VHealth Care

      XML NameMT
      XMLNSPrefix
      XMLNsURI
      XMLText
      XMLcomment
      XMLAttributes
      Struct
      Ndesc
      VHealth care industry....

       

      how can i parse this file and have the results like in the table below

      ID100
      TitleHealth Care
      DescriptionHealth care industry....

      thanks

        • 1. Re: xml parse
          cfwild Level 1

          Hi,

           

          I would run this through cfdump just to see what output you're getting:

           

          Start with something like:

           

          <cfset xmlDoc = xmlparse(whateveryourfilenameis) />

           

          <cfdump var="#xmlDoc#">

           

          This should give you a fairly nice tree to navigate.  You should then be able to create something like the following to extract your variables:

           

          <cfset ID = xmlDoc.XMLNAME.XMLAttributes.ID.xmltext />

           

          <cfoutput>#ID#</cfoutput> (should output your variable = 100).

           

          Should get you started.  The xxx.xxx.xxx should just echo whatever your cfdump tree looks like.  It will start with xmlDoc, and end with xmltext.

           

          <cfwild />