Parsing XML

Hi,
I am developing an page that will collect an address and I would like to interface the USPS API to validate and reformate the address into a standard format.  I understand how to send the request via the API (using CFHTTP) but the response back is an XML response.  Here is a sample from the docs:
<?xml version="1.0"?>
<AddressValidateResponse><Address ID="1"><Address2>8 WILDWOOD DR</Address2>
<City>OLD LYME</City><State>CT</State>
<Zip5>06371</Zip5><Zip4>1844</Zip4></Address></AddressValidateResponse>

How do I use CF to parse the response of XML?  Something simple (I HOPE)?


Also, is there a way to format XML as it is part or the form being sent to USPS.  Here is a sample request:
http://production.shippingapis.com/ShippingAPITest.dll?API=Verify
&XML=<AddressValidateRequest USERID="xxxxxxx"><Address ID="1"><Address1>
</Address1><Address2>8 Wildwood Drive</Address2><City>Old Lyme</City>
<State>CT</State><Zip5>06371</Zip5><Zip4></Zip4></Address>
</AddressValidateRequest>



Thanks much in advance,
hefterr  
LVL 1
hefterrAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gdemariaCommented:


 Use XMLparse() function to translate your XML into coldfusion structures


http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=XML_17.html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hefterrAuthor Commented:
Hi gdemaria,
Thanks for the link.  A lot of info but I think I get it.  I haven't read throug it all.

Is there a way to format (opposite of parse) XML in this case of do you kust wing it as you know the tags and you are just placing variables inbetween (say using CFSAVCONTENT) to store it as a variable for the CFHTTP request.

Thanks again,
hefterr
gdemariaCommented:

Similar to CFsaveContent is one just for XML...     <CFXML...>


http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=XML_07.html


<cfxml variable="MyXML">
  <main>
    <cfoutput query="getProd">
       <product>
          <name>#getProd.productName#</name>
          <numb>#getProd.productNumber#</numb>
      </product>
    </cfoutput>
</cfxml>

The variable #MyXML# contains the XML you can now use..
hefterrAuthor Commented:
Thanks.  I'll have to read though the docs.   If they are not clear, Istart a new thread.

hefterr
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.