Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing XML

Status
Not open for further replies.

Wullie

Programmer
Mar 17, 2001
3,674
GB
Hi all,

This is the first time I've ever needed to do anything with XML using Coldfusion and I'm getting a little stuck here.

The XML file I am parsing is the following: (This is a cut down version)

Code:
<?xml version="1.0" ?> 
   <Results>
     <ResultCode>0</ResultCode> 
     <ResultDescription>OK</ResultDescription> 
     <ResultData recordcount="1">
       <Record>
         <field name="AccountNumber">
           <value>TEST1</value> 
         </field>
         <field name="AccountType">
           <value>1</value> 
         </field>
         <field name="AccountStatus">
           <value>0</value> 
         </field>
       </Record>
     </ResultData>
   </Results>

Can anyone tell me the best way to parse this output? For example, let say I needed to return the value of AccountStatus.

I've tried a few ways and I always end up with strange errors or problems.

I'm using 6.1

Thanks in advance,

Wullie
 
Hi all,

Just an update that I figured it out.

#mydoc.results.resultdata.record.field[1].value.XmlText#

Hope this helps,

Wullie

Fresh Look - Quality Coldfusion/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top