The code I pasted in didn't appear in my original reply; here goes again...

------------------------------------------
Thanks, Paul.  Here is the output I'm getting. The first few lines are me
checking to see if the http request was successful (200=yes); 69 is the
length of the file being returned; MIME type unknown (???); and then me
trying to print the cfhttp.filecontent in a variety of ways. The rest is the
output from your code.  Any ideas on why I'm getting the "not ASCII test"
message, or what I can do about it? Is there some way to make CF think it's
getting ASCII text (b/c I _know_ the xml coming is really is ASCII!!!)?

Much thanks,

James

> 200 Succes 69 Unable to determine MIME type of file.

> The requested file is not ASCII text and can not be rendered.

> The requested file is not ASCII text and can not be rendered.

> The requested file is not ASCII text and can not be rendered.


> <wddxPacket version='1.0'>
> <header>
> </header>
> <data>
> <struct>
> <var name='BLAH'>
> <string>
> <BR>The requested file is not ASCII text and can not be
rendered.<BR></string>
> </var>
> </struct>
> </data>
> </wddxPacket>

> Data
> xml.root.data: <header>
> </header>
> <data>
> <struct>
> <var name='BLAH'>
> <string>
> <BR>The requested file is not ASCII text and can not be
rendered.<BR></string>
> </var>
> </struct>
> </data>

> xml.root.dataend: 195
> xml.root.datastart: 27
> xml.root.name: wddxPacket
> xml.root.nameend: 12
> xml.root.namestart: 2

-----Original Message-----
From: Paul Johnston [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 9:05 AM
To: CF-Talk
Subject: RE: Regular expression to parse incoming data stream?


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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to