Adding to my previous post (if you can understand the code) here is my idea
of what you should do.  Just cut and paste it into a cfm file and run it.

Paul

-----------------code-----------------

<cfset myStruct = StructNew()>
<cfset myStruct.blah = "This is fun isn't it!">
<cfwddx action="CFML2WDDX" input="#myStruct#" output="mywddx">
<cfset xml = StructNew()>

<cfoutput>
#Replace(Replace(mywddx, "<", "&lt;", "all"), ">", "&gt;<br>", "all")#
</cfoutput>

<cfscript>
    xmlpacket = mywddx;
    xml.root = StructNew();
    xml.root.namestart = Find("<", xmlpacket, 1) + 1;
    xml.root.nameend = REFind("(>| )", xmlpacket, xml.root.namestart);
    temp_count = xml.root.nameend - xml.root.namestart;
    xml.root.name = Mid(xmlpacket, xml.root.namestart, temp_count);
    xml.root.datastart = Find(">", xmlpacket, xml.root.namestart) + 1;
    xml.root.dataend = Find("</" & xml.root.name & ">", xmlpacket,
xml.root.datastart);
    temp_count = xml.root.dataend - xml.root.datastart;
    xml.root.data = Mid(xmlpacket, xml.root.datastart, temp_count);
</cfscript>

<h3>Data</h3>
<cfoutput>
    <cfloop list="#StructKeyList(xml.root)#" index="i">
        <b>xml.root.#Lcase(i)#</b>: #Replace(Replace(Evaluate("xml.root." &
i), "<", "&lt;", "all"), ">", "&gt;<br>", "all")#<br>
    </cfloop>
</cfoutput>

-----------------code-----------------

  > -----Original Message-----
  > From: James Birchler [mailto:[EMAIL PROTECTED]]
  > Sent: Tuesday, January 30, 2001 2:52 PM
  > To: CF-Talk
  > Subject: RE: Regular expression to parse incoming data stream?
  >
  >
  > I'm running CF under Linux; I think SOXML only works with
  > Windows. Also, my
  > incoming data stream is so small, I'm not sure it's worthwhile
  > to go with a
  > full XML parsing solution.
  >
  > If anyone out that can lead me to the light on regular expressions, I'd
  > really appreciate it.
  >
  > Thanks,
  >
  > James
  > -----Original Message-----
  > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  > Sent: Tuesday, January 30, 2001 12:47 AM
  > To: CF-Talk
  > Subject: RE: Regular expression to parse incoming data stream?
  >
  >
  > Could I recommend the <CF_SOXML> custom tag, which is an alternative to
  > <CF_WDDX>.
  >
  > This is available via Allaire's tag gallery.
  >
  > Mike.
  >
  > -----Original Message-----
  > From: James Birchler [mailto:[EMAIL PROTECTED]]
  > Sent: 30 January 2001 01:05
  > To: CF-Talk
  > Subject: Regular expression to parse incoming data stream?
  >
  >
  > I am sending an http request to a server (using <CFHTTP> and
  > <CFHTTPPARAM> )
  > which is responding with some xml of the form:
  >
  > <tag>
  > 353
  > <tag>
  > <anothertag>
  > 100
  > </anothertag>
  >
  > where the numbers are just examples of what comes back. Can
  > anyone give me
  > an example of what I'd need to do to use regular expressions to
  > parse the
  > incoming data stream (the server response) to just take out the
  > numbers and
  > assign them to variables in CF?
  >
  > I've explored the WDDX solution but it turns out not to be
  > viable in this
  > case.
  >
  > Thanks,
  >
  > James
  >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to