Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#73 2010-12-02 09:29:00

Maurice
Member
From: Auckland, New Zealand.
Registered: 2010-12-02
Posts: 25
Website

Re: smd_xml : extract data from XML feeds

Hi Bloke,

I was able to use your plugin for importing XML from my Goodreads feed. Now I’m trying to import some thumbnail images from flickr and I can’t get the images to show. Would you be able to look at the XML in the feed below and tell me which fields to use etc.

Here’s the code I was using, I’ve tried varied combinations.

<txp:smd_xml data=“http://api.flickr.com/services/feeds/photos_public.gne?id=38362945@N08&lang=en-us&format=rss_200” record=“item” fields=“media:title,media:thumbnail,link” wraptag=“ul” limit=“3” cache_time=“86400” >
<li>
<a href=”{link}”>
<img src=”{media:thumbnail|url}” alt=”{media:title}” width=”{media:thumbnail|width}” height=”{media:thumbnail|height}”/></a>
</li>
</txp:smd_xml>

Alternatively I could just use the Javascript badge Flickr provides, though I think it would be real cool to have them streaming through as pure XML.

Thanks, Maurice


<txp:carver category="stone" type="hard"> These bits are harder than Basalt </txp:carver>

Offline

#74 2010-12-02 15:31:06

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: smd_xml : extract data from XML feeds

The plugin can’t extract xml feed genereated with rah_external_output.
This is the URL: http://www.ristorantelapoiana.it/?rah_external_output=feed_eventi

The same xml published and linked directly as a file works fine!
Where i’m wrong?

Offline

#75 2010-12-02 22:07:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,740
Website GitHub

Re: smd_xml : extract data from XML feeds

Maurice

I think there’s an issue with the current plugin and the way it handles non-text (i.e. binary) data. The next version, which is still not finished, is in an alpha/almost beta state that is good enough to work in your case so I’ll send it over. Please let me know how you get on with it.

wornout

I don’t get it. The link you provided isn’t an XML feed. How can smd_xml be expected to parse your XHTML document? Please show me the URL of the actual feed and please post your smd_xml tag so I can try it myself to figure out what’s going on. Thanks.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#76 2010-12-03 13:55:18

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: smd_xml : extract data from XML feeds

I’m sorry! I changed the url: XML Feed
This is the smd_xml code:

<txp:smd_xml data="http://www.ristorantelapoiana.it/?rah_external_output=eventi" record="evento" fields="title" form="event-feed" />

And the very simple form:

<p>{title}</p>

Thanks

Offline

#77 2010-12-03 14:52:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,740
Website GitHub

Re: smd_xml : extract data from XML feeds

wornout

Odd, this works for me on my test site using smd_xml v0.3:

<txp:smd_xml data="http://www.ristorantelapoiana.it/?rah_external_output=eventi" record="evento" fields="title">
<p>{title}</p>
</txp:smd_xml>

I get a list of titles shown. Which version of TXP/PHP/the plugin are you running? I could try and send you the alpha of the next version and see if that helps, but I’d like to find out why it’s not working for you with the current version when it seems fine on my site. Unless the form attribute isn’t working for some reason… try it as I have above — as a container — and see if it changes anything.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#78 2010-12-03 15:39:25

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: smd_xml : extract data from XML feeds

I’m sorry again!
I was using v0.2 :(
Now everything works fine. The form works too.

However this is my config:
PHP: 5.2.14
Textpattern: 4.3.0 (r3451)

Many thanks!

Last edited by wornout (2010-12-03 15:41:34)

Offline

#79 2010-12-04 04:58:38

Maurice
Member
From: Auckland, New Zealand.
Registered: 2010-12-02
Posts: 25
Website

Re: smd_xml : extract data from XML feeds

Stef,

Much kudos to your plugin, really appreciate the alpha/almost beta version. Works like a dream.

Many thanks, Maurice


<txp:carver category="stone" type="hard"> These bits are harder than Basalt </txp:carver>

Offline

#80 2010-12-16 19:41:32

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: smd_xml : extract data from XML feeds

Hello! I want to use smd_xml’s “convert” attribute to remove part of a field in a blogger xml feed. The problem I have is that the text contains a comma. The plugin removes the text, but it always leaves a comma.

Example full contents of the field:
tag:blogger.com,1999:blog-5067636433974081748.post-4686107486591754652

The convert attribute in my smd_xml tag:
convert=“tag:blogger.com,1999:blog-5067636433974081748.post-|”

What smd_xml returns:
,4686107486591754652

I’ve tried using \ to escape the comma, but that doesn’t work. Is it possible to get that pesky comma to go away?

Offline

#81 2011-01-05 06:38:37

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: smd_xml : extract data from XML feeds

Stef

Back in post #54, you implied there was a new version coming along that would handle subfields and compound tags. Any news on progress?

Here is what I need to do…

I want to get the weather from our Bureau of Meteorology site; the feed is here.

The first issue was the data comes via FTP, so I modified your plugin to allow FTP as one of the options (and it works!).

The real problem is the format of the data. It has multiple fields with the same name but different attributes, so all I have been able to do so far is extract all of the fields.

I know there are lots of other weather sites out there with neater XML formats, but I really need to use this feed as it has the official fire danger warning which I want to display.

Offline

#82 2011-01-05 09:02:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,740
Website GitHub

Re: smd_xml : extract data from XML feeds

aslsw66 wrote:

Back in post #54, you implied there was a new version coming along

Yeah, I’m such a slacker. It’s part done and people are using the alpha version successfully.

I modified your plugin to allow FTP as one of the options (and it works!)

Brilliant, would you mind sending me the code and I’ll build that in? Thanks in advance.

multiple fields with the same name but different attributes

The new plugin has the ability to filter by attribute (erm, I think I got that far — been a long time since I looked at it) so that should help. If it’s not there right now I’ll put some time in to getting it ready for you this week.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#83 2011-01-06 05:08:16

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: smd_xml : extract data from XML feeds

Here are my modifications:

Somewhere around line 91, I added the following to allow ‘ftp’ to be one of the acceptable URLS:

if ((strpos($data, 'http:') = 0) || (strpos($data, 'https:') = 0) || (strpos($data, 'ftp:') === 0)) {

Around line 120, I add the following switch case for fsock allow for the FTP port to be used:

case 'ftp':
$url['scheme'] = '';
$url['port'] = 21;

In the end, this didn’t matter as I needed to use curl instead because getting the feed was killing my page. Not that I have the faintest idea of what curl or fsock are (apart from what Wikipedia tells me).

Offline

#84 2011-02-14 03:55:55

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: smd_xml : extract data from XML feeds

Just having a bit of a problem with the limit tag.

Last week it was working well, only showing 1 image, now it is showing all 8 included in the feed.

I checked the feed and the field is still correct, and the format of the feed hasn’t changed… but I wonder if it is because it is quite a complicated record structure:

<txp:smd_xml limit="1" data="http://gdata.youtube.com/feeds/api/users/roundmountaingirls/uploads?v=2" record="entry" fields="yt:videoid" cache_time="345600">
<img src="http://i.ytimg.com/vi/{yt:videoid}/hqdefault.jpg" style="width:276px" />
</txp:smd_xml>

I tried using ‘media’, ‘entry|media’ as the record, but got no results – so do I do nested records.

Not sure where I am going wrong here :(

Offline

Board footer

Powered by FluxBB