Erm...
CF on Linux -> use James Clarks Expat Parser for XML.
There isn't currently a simple CF interface for this though (one day...)
There is a simple Perl interface, and since you're on Linux, pass the
processing to something that can handle it. My best guess would be Perl.
The reason is that there are numerous XML modules for Perl, and they are
excellently supported by a mailing list.
Otherwise, if you are not getting complex data back (ie no CDATA sections)
then for the regex (bear in mind you can't really check whether it's an XML
packet beforehand so it's really only a hack) you need to take everything in
the <> and find everything up to the </> with the same name.
1) Create a structure to hold the XML (can store the whole thing as a
structure)
2) Then, find the first tag name (ie find a < and then the next bit of text
up to a ">" or a " ") and then find the attributes (everything up to the
next ">"...
3) Find the end tag for it (</__name__>)
4) everything in between is the data (which can contain XML)
5) pass the rest of the packet through the "parser"
Anyway, that's the way I'd do it. Maybe I'll try and do this!
Paul
PS: CDATA sections look like this:
--------------------------------------
<mydata>
<![CDATA[
<DOCUMENT>
<NAME>Paul Johnston</NAME>
<EMAIL>[EMAIL PROTECTED]</EMAIL>
</DOCUMENT>
]]>
</mydata>
> -----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