Link to home
Start Free TrialLog in
Avatar of roger v
roger vFlag for United States of America

asked on

Coldfusion XML parsing question

I have an xml document being returned from a function call. I need to retrieve values from this xml object and populate a struct. Never done this before and having issues. I've attached a screenshot of the xml document.

From that xml doc I need to retrieve values like addrCity, addrLine1, addrStateAbrv etc and then create a struct called myStruct and set that like so:

myStruct.addrCity = addrCity
myStruct.addrLine1 = addrLine1

and so on...

How do I accomplish this?
thanks in advance,

roger
xmlCleanse.doc
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of roger v

ASKER

@Zvonko:

Attached the output file.
CleansedValues.txt
Avatar of roger v

ASKER

@Zvonko,

Here's another file that has just the xml output, thanks
CleansedValues2.txt
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here an example:


<cfset myStruct=StructNew() >

<cfset myStruct.addrCity = myXML.CustomerMatchResults.BeforeMatch.Customer.BaseCustomer.XmlAttributes.addrCity >
<cfset myStruct.addrLine1 = myXML.CustomerMatchResults.BeforeMatch.Customer.BaseCustomer.XmlAttributes.addrLine1 >
<cfset myStruct.addrStateAbrv = myXML.CustomerMatchResults.BeforeMatch.Customer.BaseCustomer.XmlAttributes.addrStateAbrv >


<cfdump var="#myStruct#" >

Avatar of roger v

ASKER

Thanks for the help!

roger
You are welcome.