Question : Coldfusion Regex find question

I have an xml element in a struct. I need to find some values in that xml document.

My example code is attacehd. I need to find the value that is between the <leadId> and </leadId> element, as well as the value in the attribute of <error code="0">need to find this text</error>

So I need something like:
myLead = ReFind(myXMLFile, "regex pattern")
myErrorCode and myErrorText

How do I do this?

       
1:
<?xml version="1.0" encoding="utf-8"?> <postResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.xxxxx.com/xxxxxx/services/2008/09/indry.asmx">  <leadId>0</leadId>  <successful>false</successful>  <message>Error occurred, see errors for details</message>  <errors>  <error code="0">Invalid Postal Code (34343)</error>  </errors> </postResponse>

Answer : Coldfusion Regex find question

If you're referring to my suggestion of using XML, it would not be combined with a Find at all.

Once you have it parsed as XML, it would then exist in a structure, you can see the structure by the CFDUMP command, then it is easy to directly access the item such as...

<cfset theResult = xmlParse(MyXmlFile)>

#theResult.leadID#

But usually something a bit more than that.  In order to give you the exact variable, I would need to see the dump.   You should be able to look at the dump and follow the path names to the variable you want starting with TheResult...
Random Solutions  
 
programming4us programming4us