ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

XML Parser What am I missing?

June 11, 2011 7:29am

Subscribe [3]
  • #1 / Jun 11, 2011 7:29am

    Gabriel Lago

    13 posts

    Hi,

    I need to show some data from an xml feed in our site (EE2 1.6.4beta), but I must be missing something…

    I´ve installed the ajw_feedparser plugin, (and already checked it works…)

    The xml feed is this one: http://desarrollo.capitalbolsa.com/ws , with this structure:

    <noticiasResponse>
        <noticia>
            <id>58141</id>
            <fecha>2011-01-03 08:05:05</fecha>
            <titulo><![CDATA[...whatever…]]></titulo>
            <subtitulo><![CDATA[]]></subtitulo>
            <contenido>...whatever…</contenido>
            <secciones>
            </secciones>
            <valores>
            </valores>
        </noticia>
        <noticia>
          ...
        </noticia>
    </noticiasResponse>

    That´s the code I´ve placed in the template:

    {exp:ajw_feedparser
    url="http://desarrollo.capitalbolsa.com/ws"
    itempath="/noticiasResponse"
    cache_refresh="100"
    limit="5"
    debug="true"
    }
    <h2>{titulo}</h2>
    <p>{if no_results}<br />
    No results<br />
    {/if}<br />
    {/exp:ajw_feedparser}

    I´ve tryed changing the itempath, in any combination of /noticasResponse/noticias…
    But I´m not retrieving any data at all… just No results
    Does anybody knows what am I doing wrong or if it´s anything in the source of the feed?

    Thanks in advance,
    Gabriel

    [Mod Edit: Moved to the Community Help forum]

  • #2 / Jun 11, 2011 9:56am

    Andrew Weaver

    206 posts

    Hi,

    I think the XML is invalid.

    There seems to be a block of javascript at the end (after the closing </noticiasResponse> tag) which I think is stopping the XML parser working correctly.

    Andrew

  • #3 / Jun 11, 2011 10:36am

    Gabriel Lago

    13 posts

    Hi Andrew,

    I´ll talk with the people that sends the feed…

    Thank you so much
    Gabriel

  • #4 / Jun 11, 2011 10:59am

    Andrew Weaver

    206 posts

    No problem.

    Let me know if you continue to have a problem.

    Andrew

  • #5 / Jun 12, 2011 4:19pm

    Greg Salt

    3988 posts

    Thanks Gabriel and Andrew. I’ll move this thread into the Community Help forum for you.

    Cheers

    Greg

  • #6 / Jun 13, 2011 3:42pm

    Gabriel Lago

    13 posts

    Hi again,

    The people from the feed http://desarrollo.capitalbolsa.com/ws has now changed the code, and I think now it´s valid XML what they´re serving.

    But there´s still something I´m doing wrong, I´m not being able to show any content…

    Should the code I placed in the first post show the content??

    Thanks,
    Gabriel

  • #7 / Jun 13, 2011 5:38pm

    Andrew Weaver

    206 posts

    I used this:

    {exp:ajw_feedparser
    url="http://desarrollo.capitalbolsa.com/ws"
        itempath="/noticiasResponse/noticia"
        cache_refresh="100"
        limit="5"
        debug="true"
    }

    which seems to work now.

    Andrew

  • #8 / Jun 14, 2011 4:46am

    Gabriel Lago

    13 posts

    Hi Andrew,

    so it works for you! it doesn´t for me…

    I´m not sure it there´s something on my config…

    I´ll try to check it..

    Thanks anyway,
    Gabriel

  • #9 / Jun 14, 2011 6:31am

    Andrew Weaver

    206 posts

    Hi Gabriel,

    The plugin tries to use the CURL library to read the file. It might be worth checking you have CURL support in PHP

    What debugging messages are you gettting> Just “No results”?

    Andrew

  • #10 / Jun 14, 2011 9:07am

    Gabriel Lago

    13 posts

    Hi Andrew,

    The plugin worked when I used one of the examples you provide in the webpage documentation, so it has to have CURL support… we´re already on EngineHosting hosted…

    Yes, the only I get is “No results”, any debugging messages at all.

    Thanks for your time,
    Gabriel

  • #11 / Jun 14, 2011 7:57pm

    Gabriel Lago

    13 posts

    Hi again…

    I´ve been playing a little with curl, and I´ve seen where the problem must be…

    The server of the feed is sending a 301 error and a redirection, what it´s probably stopping the plugin

    I´ve added

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

    to the source of the plugin and now it works on my local install… but I´m not sure why, in the production server doesn´t!!

    Any tip or idea will be welcome 😊

    Thanks anyway,
    Gabriel

  • #12 / Jun 16, 2011 5:57am

    Andrew Weaver

    206 posts

    Hi Gabriel,

    If you are still having problems with this I can send you a copy of the plugin that uses a different method to fetch the feed. Email me at .(JavaScript must be enabled to view this email address).

    Andrew

  • #13 / Jun 16, 2011 6:03am

    Gabriel Lago

    13 posts

    Thanks so much, I send you an email Andrew.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases